One Star

[resolved] Please help me with RUNif condition for TfileRowcount

HI Team ,
I need check whether file is empty or not , for that I m using TfileRowcount  to get total number of records what condition do I  need to write in runif . If number of records zero it should file is empty or it should display totalnumber of records ...................
thanks!
1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: [resolved] Please help me with RUNif condition for TfileRowcount

Hi
If file exists,  you can use a tFileRowCount to populate the number of lines, there is a global variable called ((Integer)globalMap.get("tFileRowCount_1_COUNT")) that stores the result. eg:
tFileExist--runIf--tFileRowCount--oncomponentok--tFixedFlowInput--main--tLogRow
on tFixedFlowInput, generate the number of lines, define one column let's say it as "nb_line", set its value as:
((Integer)globalMap.get("tFileRowCount_1_COUNT"))
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
4 REPLIES
Fifteen Stars

Re: [resolved] Please help me with RUNif condition for TfileRowcount

You can do this by following the image I have attached to this post. The file has a parameter called "number of lines". This can seen circled in red on the left. Drag this over to your RunIf link component condition. Then set the greater than/less than logic you require. You don't actually need the row count component.

Rilhia Solutions
One Star

Re: [resolved] Please help me with RUNif condition for TfileRowcount

Thanks rhall, its working but
But my requirement if the file is empty it job should abort with message " No records" if not it should give me total number of records .......for my auditing purpose ..  above solution is not giving me total number of records could you please help me with how I can fetch total number of records ..
Thanks
Mohini
Community Manager

Re: [resolved] Please help me with RUNif condition for TfileRowcount

Hi
If file exists,  you can use a tFileRowCount to populate the number of lines, there is a global variable called ((Integer)globalMap.get("tFileRowCount_1_COUNT")) that stores the result. eg:
tFileExist--runIf--tFileRowCount--oncomponentok--tFixedFlowInput--main--tLogRow
on tFixedFlowInput, generate the number of lines, define one column let's say it as "nb_line", set its value as:
((Integer)globalMap.get("tFileRowCount_1_COUNT"))
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Please help me with RUNif condition for TfileRowcount

Many thanks Shong its working .............
Smiley Happy
MOhini