Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
How to merge two job output in a single output file.I am adding screenshot of my job:
I have to merge tFileOutputDelimited_3 and tFileOutputDelimited_4 out put in a single output file.Thanks in advance.
because You are attaching as a source my example (sure not the best way, but it was created fast on one of the projects)
You can see below on the same page - for convert csv (comma delimited) string, I read from a file as \t (TAB) delimited, in this case, all row it a single column
If You check other links, You can create more elegant code of course
P.S.
You always could use csvkit, I use it as well from talend for different reasons
why just not append to first file?
Vinayak,
If the schema for both the files/flows are same you can use tUnite component to combine the result set.
In case of different schema, you could append the resultset.
In the first file remove "Throw an error if the file exist" in advanced setting of tFileOutputDelimited so the the file will be overwritten for every iteration. make sure "append" is unchecked in basic settings.
In the second file should be appended by checking "append" in basic settings.
Regards,
Ragu
In tFileOutputDelimited_4, go to basic settings then check (tick) the "Append" and make sure the
"File Name" is same for both tFileOutputDelimited_3. below is the screen shot.
Hi arragupathy,
As per your suggestion i have appended successfully. Now i got a output as a delimited file:
Now i have to generate a json file of it, like this:
Is there any way to achieve it, as this file having no schema define. Thanks in advance.
@vinayak019 wrote:
Hi arragupathy,
As per your suggestion i have appended successfully. Now i got a output as a delimited file:
Now i have to generate a json file of it, like this:
Is there any way to achieve it, as this file having no schema define. Thanks in advance.
it possible to write java code for this
https://dzone.com/articles/how-to-convert-csv-to-json-in-java
or use something ready to use -
https://csvkit.readthedocs.io/en/1.0.3/
https://csvkit.readthedocs.io/en/1.0.3/scripts/csvjson.html?highlight=csvjson
Hi Vapukov,
I was using your suggested approach in https://community.talend.com/t5/Design-and-Development/need-to-convert-delimited-file-to-key-value-p... this.
So my job design like this:
I have replaced '|' delimited with ',', so input file is like that only:
tFileInputDelimited_2 setting:
tJavaFlex_1 code:
now again, OnComponentOk, tFileInputDelimited_3 setting:
tjavaFlex_2 setting:
tJavaFlex_3 setting:
output of this job is:
Why it is creating json for first record only. my expectation is:
Where I am doing mistake, please let me know.
think You are not read till the end of page
find on page text about delimiter 🙂
Hi,
Will you please explain a little more, not getting it exactly.