Splitting a Tmap output into several tables based on the value of a column - talend

I have an output of tmap below is:
|src_table|src_columname
--------------------------
|Account |ID
|Account |Name
|Account |Owner
|Contact |ID
|Contact |Name
|Contact |FirstName
|Contact |LastName
I want output in two table like first Account and second Contact
Account
-----------------
ID |Name |Owner |
Contact
-------------------------------
ID |Name |FirstName |LastName |
I am beginer in taled. Please tell me which component i need to use for above output.
Actually, I am not an expert user and I don't found my solution. scenario is:
I'm trying to migrate some 10 tables from SQL server dB to oracle server DB and i wish to use Talend but I don't know in which way I could make it. First I tried by below method: I have created many sub-jobs for mapping table by table in one job, because each table has a different table structure, I have created different sub job with the corresponding schema, for example tOracleInput_1--main tMSSQLOutput_1 (migrate table1) |
onsubjobok |
tOracleInput_2--main--tMSSQLOutput_2 (migrate table2) |
onsubjobok |
...other subjobs for other tables...
But I do not want to create many sub job. is there any way like i need to create one subjob for all tables?

You'll have to use multiple outputs in tMap, and use the filter option in it.
Add a second output to your tMap .
Then activate a filter on both outputs (filter button in the yellow bar title)
In output #1, put a filter on src_table, like "Account".equals(row2.src_table)
In output #2, put a filter on src_table, like "Contact".equals(row2.src_table)
Then you will have only Accounts in your first output, only Contacts in your second output.

Related

How to filter rows based on a condition and if the condition isn't met, grab another row in Talend?

It was hard to think of a title for this question, so hopefully that did make sense.
I will explain further. I have a flow of data from an Excel file and each row has one of two words in the last column. It will either contain "Open" or "Current".
So lets say I have an input that looks like this:
NAME | SSN | TYPE
John | 12345| Current
Katy | 99999| Current
Sam | 33333| Current
John | 12345| Open
Cody | 55555| Open
And the goal is grab only a person once. Each person has their unique id as their SSN. I want to grab Open rows if both Open and Current exist for that person. If only Current exists, then grab that.
So the final output should look like this:
NAME | SSN | TYPE
Katy | 99999| Current
Sam | 33333| Current
John | 12345| Open
Cody | 55555| Open
NOTE: As you can see, the first entry for John has been removed since he had an Open row.
I have attempted this already but it is sloppy and I figure there must be a better way. Here is an image of what I have done:
Talend flow
Here's how you can do it:
First sort the data by Name, and Type descending (this is important so that for each person, the Open record is on the top); then in the tMap filter it like this:
Numeric.sequence(row2.name, 1, 1) == 1
Only let the record through if this is the first we're seeing this name.

Lookup in LibreOffice Calc to match partial string of the search criterion

I'm putting my banking information in a LibreOffice Calc spreadsheet.
I have columns as follows, that I imported from my bank account:
Date | USD | Description | Category
----------+-------+---------------------------------------------+----------
2/28/2019 | 44.00 | POS 0123 2345 123456 FRED-MEYER #02 | groceries
2/27/2019 | 2.50 | PANDA EXPRESS #123 TIGARD OR - 123546789012 | lunch
These descriptions are very unpredictable, they're whatever merchants want them to be, but they can tell me useful information about what I spent my money on. I've used this information to manually enter the categories. But I'm looking to automate this for common things.
So, I created a separate sheet with lookup values, like so:
Expression | Category
-----------+----------
FRED-MEYER | groceries
PANDA | lunch
I am looking for a formula in the "Category" column of the first sheet to automatically determine categories, based on the lookup table in the second sheet. (Obviously I don't plan for the lookup table to be exhaustive, but whatever I don't put in there, I can enter in the first sheet manually, thus overwriting the formulas.)
I had this working fine in Excel using a nifty construct of SEARCH and MATCH. (I don't even understand it anymore and I don't have Excel to check.) But since I'm now a Linux user, I'm trying to use LibreOffice, and I've not been able to make this work with formulas. I tried SEARCH, MATCH, LOOKUP, VLOOKUP, FIND, with and without regexes and with different options on/off. But no success so far.
I think this is very similar to this question, though it was only answered for Excel (I'm using Calc).

Crystal Reports 2011 - Suppressing Information Based on Certain Criteria

I'm going to attempt to word this question without being too confusing.
We have a report we want to show each patient and their insurance. Each of the insurance in the patient's record is number by an Order Number. However, we don't only want to show that; I want to put in certain criteria so that if Insurance A has order number 1 under the Patient ID, show all of this patient's insurance. If the patient does not have Insurance A in Order Number 1, do not show this patient nor any of their information on the report.
In the code below, guarantor is referring to insurance. So order number and guarantor name is what we're focusing on. Here's the code I've put into Section Expert for the Suppress option. What I assume is if it meets the criteria, TRUE will suppress the information, else FALSE will allow the information. However, this is not sufficient as it suppresses all of the other information.
if {billing_guar_order_no_ep.guarantor_order_number} = "1" AND
{billing_guar_order_no_ep.guarantor_name} = "Medicare" then
false
else
true
What I'm assuming is it will need to iterate or loop through every patient and if it finds this information, list ALL of the patient's information and move forward, else suppress and move forward. I hope this makes sense.
Example:
|Patient ID|Order Number|Guarantor Name|
| -------- | ---------- | ------------ |
|1 | 1|Medicare |
|1 | 2|Medicaid |
|2 | 1|Medicaid |
|2 | 2|Medicare |
In the above example, what I want is for the report to show everything from Patient #1 (including all order numbers) and to not even show Patient #2 in the report. However, what's happening is Patient #1 does show up, but only Order Number 1; it suppresses all the other information.
What am I missing?
The query that you want will be an adaptation of this:
select *
from data d
where not exists (
select 1
from data
where pat_id=d.pat_id
and order_id=1
and guarantor_name='Medicaid'
)
The 'Linking Expert' doesn't support this syntax, so you'll need to use a Command instead.
Process:
get the current query by selecting Database | Show SQL Query ...
create a new report
select 'add command' from within the database expert
paste the query, then adapt it

Talend combine two different data flows with same schema into one

I am using talend 6.1.1 and i am i have two components tmysqlinput and tfixedflowinput.
Schema is same for both the components and i am trying to combine the data generated by these components.
for example: schema is like col1 and col2
output of tmysqlinput component is:
1,2
2,3
output of tixeflowinput component is:
3,4
4,5
Now output which i am expeting is like combination of both the ouputs.
It should be like:
1,2
2,3
3,4
4,5
Please help me to combine the outputs of those two components.
An alternative to using tUnite is tHashOutput.
For example:
tMySqlInput--main-->tHashOutput
|
onSubjobOK
|
tFixedFlowInput--main-->tHashOutput
|
onSubjobOK
|
tHashInput--main-->tFileOuputDelimtited
In the second tHashOutput, make sure to associate it with the first tHashOutput.
In the tHashInput, make sure to associate it with the first tHashOutput.
tUnite would generally be preferred, but depending upon the case tHashOutput can be appropriate.
If the schema is exactly the same, you can send the row output of both components into a tUnite component
https://help.talend.com/display/TalendComponentsReferenceGuide54EN/tUnite

merging rows in postgres with matching fields

I have a table format that appears in this type of format:
email | interest | major | employed |inserttime
jake#example.com | soccer | | true | 12:00
jake#example.com | | CS | true | 12:01
Essentially, this is a survey application and users sometimes hit the back button to add new fields. I later changed the INSERT logic to UPSERT so it just updated the row where email=currentUsersEmail , however for the data inserted prior to this code change there are many duplicate entries for single users. i have tried some group by's with no luck, as it continually says the
ID column must appear in the GROUP BY clause or be used in an
aggregate function.
Certainly there will be edge cases where there may be clashing data, in this case maybe user entered true for the employed column and then in the second he/she could have enter false. For now I am not going to take this into account yet.
I simply want to merge or flatten these values into a single row, in this case it would look like:
email | interest | major | employed |inserttime
jake#example.com | soccer | CS | true | 12:01
I am guessing I would take the most recent inserttime. I have been writing the web application in scala/play, but for this task i think probably using a language like python might be easier if i cannot do it directly through psql.
You can GROUP BY and flatten using MAX():
SELECT email, MAX(interest) AS interest,
MAX(major) AS major,MAX(employed) AS employed,
MAX(inserttime) AS inserttime
FROM your_table
GROUP BY email