• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » output different rows to single file from different tables.

#1 2010-07-29 08:52:09

jsixface
New member
Registered: 2010-07-29
Posts: 4

output different rows to single file from different tables.

Hi,
I need a solution for my peculiar problem.
Here are my requirements.

* I have a table called items which is the main feed.
* I have two other tables called AT and Notes. for each entry in items, there may or may not be a row in these two tables.
* In the output file, comma or pipe sepearated, the first row needs to be the data from ITEM, the next row should be from AT if available , and the third row should be from Notes if notes available for that item. And then ITEM, AT, Notes.

So, you got it ??
output needs a repetitive set of 3 rows...

sample output could be,
--------------------------
ITEM
AT
AT
NOTE
ITEM
AT
NOTE
ITEM
NOTE
ITEM
ITEM
------------------------


i"ve been searching a solution all over it and couldn't find any... can someone help me please ???

Offline

#2 2010-07-30 03:18:07

alevy
Member
Registered: 2009-11-20
Posts: 1477

Re: output different rows to single file from different tables.

Try reading from the items table and sending to your output and then to a tFlowToIterate component.  Use the tFlowToIterate to store the values from the items tables that are used for joining to the AT and Notes tables.  Then from the tFlowToIterate have two iterate links, one to an input component for the AT table and one to an input component for the Notes table.  The SQL in the input components should have a where clause using the globalMap variables created by the tFlowToIterate.  Each of the input components then has a flow to your output.


Uploaded Images

Last edited by alevy (2010-07-30 03:21:22)

Offline

#3 2010-08-02 09:44:54

jsixface
New member
Registered: 2010-07-29
Posts: 4

Re: output different rows to single file from different tables.

Hi Alevy,
Thank you for your response.. I have implemented what you have said, and it works fine.
But the real problem is merging the files.
The output needs to be like

ITEM1
|
└-- (entry from AT, if available for that item1)
|
└--(entry from Notes, if available for that item1)
ITEM2
|
└-- (entry from AT, if available for that item2)
|
└--(entry from Notes, if available for that item2)
and so on..

Offline

#4 2010-08-02 10:09:22

alevy
Member
Registered: 2009-11-20
Posts: 1477

Re: output different rows to single file from different tables.

Sorry, I'm not clear exactly what you want and why my suggestion is not giving you that result.  Can you give an example?

Offline

#5 2010-08-02 11:47:03

jsixface
New member
Registered: 2010-07-29
Posts: 4

Re: output different rows to single file from different tables.

i hope the image explains better...
the 3 output file from 3 tables needs to be merged according to the item_id.
all the 3 files contains item_id as one field.


Uploaded Images

Offline

#6 2010-08-04 11:02:23

jsixface
New member
Registered: 2010-07-29
Posts: 4

Re: output different rows to single file from different tables.

hello...
does anyone knew any solution to my problem ??

Offline

#7 2010-08-06 08:38:33

alevy
Member
Registered: 2009-11-20
Posts: 1477

Re: output different rows to single file from different tables.

Sorry, I wasn't clear.  Each of the output components shown in my screenprint should be to the SAME file.  Just make sure you check the "Append" option.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » output different rows to single file from different tables.

Board footer

Powered by FluxBB