Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good day guys
I am having difficulty with a specific use case in Talend. I have simplified my problem a bit below:
I have two text files, one contains a list of names like so:
John
Peter
Sandra
The second file contains a list of surnames like so:
Williams
Alkema
Smith
The 2 files will always have the same number of records.
I need to join these 2 files together, line by line, like so:
John Williams
Peter Alkema
Sandra Smith
In Java this is rather straight forward. One can read the names into and array, and then the surnames into an array, and loop through them like so:
for (int i = 0; i < name_array.length(); i++)
{
System.out.println (name_array[i] + " " + surname_array[i]);
}
But how can I do this in Talend? I need to write the combined string out to a file again.
Thank you
Here a solution:
tMap to add a sequence (you 2 with the same model):
tMap to join the records:
If you simply want to join them sequentially, you could add a sequence to each input (using tMap) and then use a third tMap to join them on sequence.
Here a solution:
tMap to add a sequence (you 2 with the same model):
tMap to join the records:
Thank you to you both. You guys are too awesome! And thank you for building the job for me with screenshots, I really appreciate it.
I am back at work on Thursday and will try it out. I will let you guys know how it goes.
Hi there
I got around to testing the solution and it is working great.
I subsequently moved away from files and used a hashmap, and things are looking good!