Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am new to Talend and I want to know how I can iterate through a file and compare a value with a table.
Suppose I want to check if a driver has how many fines.
Table Driver: ID, d_license, name
Sample data:
1, 54B43D, John Smith
2,343d23F, Jane Do
3, 567S4R, Sharlot J.
Fine.csv: fine_id, name, fine
Sample data:
42, Jane Do, 54$
23, John Smith, 43$
54, Jane Do, 17$
Desired output:
ID, driver license, Name, fines(how many), Total
1, 54B43D, John Smith, 1, 43
2,343d23F, Jane Do, 2 , 54+17
3, 567S4R, Sharlot J.,0,0
Hi,
Please refer the screenshots for overall flow and component details.
Driver details will be the main flow and fine file will be the lookup flow. The first step is to remove $ value from fine file.
row2.fine.replaceAll("\\$","")
Then convert the fine value from String to integer.
The next stage is to do all Match for the fine lookup data with driver main flow and join them using tMap.
Now, do the group by and add two new columns to do the count and sum. You will get desired output from the output connection of this component.
The name of all components are available in screenshots themselves. Please spare a second to mark the topic as resolved.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂