Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
pawe84
Creator
Creator

Chech delimited file if it's empty

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.

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

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.

View solution in original post

2 Replies
Anonymous
Not applicable

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

TRF
Champion II
Champion II

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.