Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tMap resultset in tJava

Can we get the Resultset from the tMap to be manipulated in tJava?
Labels (3)
9 Replies
Anonymous
Not applicable
Author

If you want to process the output of tMap with a piece of Java code, you can link the output to a tJavaRow, instead of tJava. About the usage of Java components, the difference between tJava and tJavaRow, please refers to
https://help.talend.com/search/all?query=The+difference+between+tJava%2C+tJavaRow+and+tJavaFlex&cont...
Shong
Anonymous
Not applicable
Author

Thanks Shong for reply.
By going through the link, it seems it processes each row one by one.
In my case we have data coming in multiple rows, which has to be identified based on a field. process all these and print in some specific format.
Let me know how can we achieve this?
Thanks
Jatin
Anonymous
Not applicable
Author

Can you explain your requirement with some data? It will be helpful for us to understand the problem and help you.
Shong
Anonymous
Not applicable
Author

Hi Shong,
We have 2 tables. Order and Order_Item. We have to join these 2 tables. As shown

The Order contains Order details and Order_Item contains details about each item purchased by customer.
We have to read these two database tables are write a text file.
Below is the output file format, which is to be iterated for all the orders. I have specified for format example for 1 order record.
1) #|00611|001|1234|06/26/2013 10:55:00|00000096660|987651234|test@test.com|Order_1
2) $|1872|Item_1|11.11|Shirt
3) $|1847|Item_2|76.11|Jeans
4) $|1879|Item_3|35.11|Top
5) %|4|3|122.33
First line contains Order specific details such as Order number, creation date, email id. 2 to 4th line contains order items details such as item no, description, price. The last line 5th contains aggregate of no of lines for the order, no of line items and total price.
Let me know what type of components we need to use or write our custom java code to produce desired output.
Thanks
Jatin
Anonymous
Not applicable
Author

To do this, think of your output file as 3 separate files:
1) order header file
2) order detail file
3) order trailer file
You can then attempt to build each of these files separately in Talend.
Once you've got the files built separately, you simply concatenate them together in the correct order to produce your final file.
Anonymous
Not applicable
Author

Dear Jatin,
I would suggest to join each of the results to a single output seperately.
1. Get the header or the top information and link (send) to a file output and uncheck the Append field in the output component.
2. Get the data details and link (send) to the same file output from step 1 and make sure the Append field is checked.
3. Get the footer or the bottom information and link to the same output from step 1 and make sure the Append field is checked.
Step 1 will ensure that every time there is a new request, the output file will automatically be create afresh and will insert the new data from step 1 and append the data from step 2 and 3.
Hope this helps.
G
Anonymous
Not applicable
Author

Hi John,
Thanks for reply.
As per your suggestion I need to put values in 3 separate files and then process these 3 files to produce desired output.
My question is what type of Talend component I should use to concatenate these files? Also do I need to write some java logic to find record in second file based on first file record?
Thanks
Jatin Gupta
Anonymous
Not applicable
Author

Hi G,
Thanks for reply.
I am not able to understand uncheck the Append field suggestion, as I am newbie on Talend. Can you elaborate more or gives some references. What would really help.
Thanks
Jatin Gupta
Anonymous
Not applicable
Author

Hi Jatin,
When you double click the component, or select the component's properties, under basic settings you can see a check box "Append". Try playing around with tFileExcelOutput or tFileOutputDelimited components and let us know if still are not able to solve.
G