Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How I can check if a delimited file is empty except the headline?
Let say this is an csv output but nothing has been appended:
Column1|Column2
If I use tfileExist the condition is always true because the file exists because of the header.
Thanks for any advice.
tFileRowCount with the option "Ignore empty rows" is a solution.
If row count is > 1 (((Integer)globalMap.get("tFileRowCount_1_COUNT")) > 1) then the file contains the header line + at least 1 non empty line.
Hi,
The most easy way is to read the file and send the output to a tAggregateRow component. Create an output column which will calculate the total count of records. If the value is not zero, it means you have data else its empty file.
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
tFileRowCount with the option "Ignore empty rows" is a solution.
If row count is > 1 (((Integer)globalMap.get("tFileRowCount_1_COUNT")) > 1) then the file contains the header line + at least 1 non empty line.