How to split a row of tmap or tlogrow into two rows in a output-file ?

One Star

How to split a row of tmap or tlogrow into two rows in a output-file ?

For creating a new interface-file I need to do the following:
Import csv-file and aggregate data with lookup-tables in tmap, where every row in tmap is a booking in the new system; the output-file needs 2 rows (head and position) for each booking
Example (Date,currency,amount,vat,text,accountNo,customerNo,invoiceNo)
29.04.2010,USD,5000.00,19%,text,3000,10201,2010001002
Now I have to split this row from tmap or tlogrow into a header-row and a position-row in the same output-file
example: outputfile=bookings.csv


bookings.csv
2010001002,rthead,10201,5000.00,text
2010001002,rtposition,5000.00,3000,19%,text

How to do this ? I could only write 1 row into the output-file from the tmap or tlogrow component.
thanks a lot for your help
One Star

Re: How to split a row of tmap or tlogrow into two rows in a output-file ?

no one a idea ?
Employee

Re: How to split a row of tmap or tlogrow into two rows in a output-file ?

Hi,
Create two output in your tMap : 1 output for your row1; another output for your row2 (you can specify the order of each one).
Then you redirect the outputs to the same tFileOutputDelimited and you check the option APPEND.
The result would be exactly what you're expecting; a file Delimited :
bookings.csv
2010001002,rthead,10201,5000.00,text
2010001002,rtposition,5000.00,3000,19%,text
Best regards;
One Star

Re: How to split a row of tmap or tlogrow into two rows in a output-file ?

Hi,
Create two output in your tMap : 1 output for your row1; another output for your row2 (you can specify the order of each one).
Then you redirect the outputs to the same tFileOutputDelimited and you check the option APPEND.

What do you mean by "create two output ? --> right click on tMap and then new output ??? and if so, to wich destination ?
What do you mean by "redirect" ?
I can't get successful to set more than one output to the same destination (in this case the tFileOutputDelimited)
So what component should I use after the tMap component ?
In VB I did it this way:
-opening the output file
-selecting the first line of the import-file (in this case the tMap component)
-reading the fields needed for the header-line and writing them to the output file
-reading the fields needet for the position-line and writing them to the output file
-going to the next line
-doing this till the end of the import
-closing the file
Employee

Re: How to split a row of tmap or tlogrow into two rows in a output-file ?

Hi;
Yes you create a new output in the tMap and you link this one to a new tFileOutputDelimited component which you pick up from the palette.
You'll use two different tFileOutputDelimited_1 and tFileOutputDelimited_2 => but both are going to the same location like /tmp/files/myresult.csv (you set up this in the property)
And don't forget to enable the APPEND option in both components.
One Star

Re: How to split a row of tmap or tlogrow into two rows in a output-file ?

OK, now I understand.
Another Question to this
Is there a possibility to sort the output to the physical File ?
not to write the whole tFileOutputDelimited_1 and after to append tFileOutputDelimieted_2
but write the first line of tFileOutputDelimited_1 then the first line of tFileOutputDelimited_2, and so on.
Employee

Re: How to split a row of tmap or tlogrow into two rows in a output-file ?

Hi,
The Job should be something DESIGNED like this (cf the screenshot).
You can see the ORDER of the Output is the Order in your tMap, you can change that to have the right order.
If you are interested to order the DATA itself; you must use a tSortRow and specify the sort criteria on the right columns.
Best regards;