Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
I have a delimited flat file of 1000 lines, I want to divide it into 3 files, depending on the value of column 0, how do I do this? If the value of column 0 is == 1, go to a file; if the value is == 2 it goes to another file.
Thanks!
Hi,
It seems your Column0 is having null values. Could you please modify the code as below to handle the null scenario?
Relational.ISNULL(row1.Column0)? null : ((row1.Column0==1) ? row1.Column0 : null)
Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
First solution, 1 tMap with 3 output flow and the appropriate filter expression for each.
Second solution, 1 tFilterRow to separate records for file 1, then a second one to separate records for file 2 and 3.
something I forgot to mention is that those that are type 1 and type 3 have fewer fields than type 2, does this affect?
when I execute it, a Null Pointer error is generated
Hi,
It seems your Column0 is having null values. Could you please modify the code as below to handle the null scenario?
Relational.ISNULL(row1.Column0)? null : ((row1.Column0==1) ? row1.Column0 : null)
Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
I already managed to write different files, but now I want those who do not fulfill the condition, NOT to occupy unnecessary lines.
Thanks!
Hi,
The tmap says that your Column0 is not nullable. I hope you have checked the input data is not having any null value for Column0. Also I hope you are not picking any null rows.
If you have checked both these conditions, then you will have to check the functions. Somewhere you are passing the value as null.
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 🙂
I already managed to write different files, but now I want those who do not fulfill the condition, NOT to occupy unnecessary lines.
Thanks!
Hi,
Either you can add an null check expression in your output area so that it will not write the empty data. Or you can avoid them by filtering later using a tfilterrow component.
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 🙂