[resolved] unable to count file row count

Five Stars ami
Five Stars

[resolved] unable to count file row count

Hello,
I have a job which captures all details of the files in a particular folder.Like file_rowcount , size or file_name,
But i am unable to capture file_rowcount
Please see my job designe:-



tfilelist:-

tfileproperties:


tfilerowcount:-

tmap:

the output i am getting correct except count is not matching with the file , its giving any random xyz figure.
Please help here
Thanks.

Accepted Solutions
Community Manager

Re: [resolved] unable to count file row count

Hi 
It is a job design issue, the global variable should be used after component, it should be:
tfilelist--iterate--tfilerowcount--oncomponent--tfileproperties--main--tmap.....
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] unable to count file row count

Hi 
It is a job design issue, the global variable should be used after component, it should be:
tfilelist--iterate--tfilerowcount--oncomponent--tfileproperties--main--tmap.....
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars ami
Five Stars

Re: [resolved] unable to count file row count

Dear Shong,
Thanks for reply,
i just did what you said , same issue , row-count coming incorrect , even if file has only header , its giving count as 44.

All logic is same. just shifter the positions as suggested by you.
but same issue, even file has no records still it shows any random figure.
Five Stars ami
Five Stars

Re: [resolved] unable to count file row count

Dear Shong,
Its resolved,
row separator for tfilelist was wrong , default should have been "\n".
Thanks.
Community Manager

Re: [resolved] unable to count file row count

Great, thanks for your feedback!
----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars ami
Five Stars

Re: [resolved] unable to count file row count

Dear Shong,
In this job , if there are 10 files in the directory , how will i find the count of files in the same job ?
any global variable function ?
Can you suggest?
Thanks
Four Stars

Re: [resolved] unable to count file row count

Hi ,
You can do it ,it is  pretty simple .
tfilelist > tfileinputdelimited>tmap > tfileout >tjava
In tjava component , you can use the global variable ,which will help you to print the filename and row count of file ,which is being processed by tfilelist.Below are the screenshots for the same.

Five Stars ami
Five Stars

Re: [resolved] unable to count file row count

Dear Harkirat,
Thanks for reply , i want to include the logoc in the same job which i made it , please have a look at it above screen shots are attached
Five Stars ami
Five Stars

Re: [resolved] unable to count file row count

Hi ,
You can do it ,it is  pretty simple .
tfilelist > tfileinputdelimited>tmap > tfileout >tjava
In tjava component , you can use the global variable ,which will help you to print the filename and row count of file ,which is being processed by tfilelist.Below are the screenshots for the same.
195095/mini_blob_20170104-0939.png
195095/mini_blob_20170104-0940.png

i need to find the file count not the file row count 
Five Stars ami
Five Stars

Re: [resolved] unable to count file row count

Dear Shong,
In this job , if there are 10 files in the directory , how will i find the count of files in the same job ?
any global variable function ?
Can you suggest?
Thanks

Dear Shong,
How can i find the total files in a particular folder?
In the same job i want to find the total files , can you suggest please?
Community Manager

Re: [resolved] unable to count file row count

Hi
There is a global variable that counts the total number of files are found in the directory.
((Integer)globalMap.get("tFileList_1_NB_FILE"))
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars ami
Five Stars

Re: [resolved] unable to count file row count

Hi
There is a global variable that counts the total number of files are found in the directory.
((Integer)globalMap.get("tFileList_1_NB_FILE"))
Regards
Shong

Dear Shong,
I used the same global variable , but its giving me sequence number for every row.
ex: if there are 40 files in the folder . 
it will give me sequence 
1
2
3
4.
.
.
.till 40
I want 40 to display to every where instead of sequence.
Community Manager

Re: [resolved] unable to count file row count

Where do you use this global variable? It should be used in next subjob if you want to get the total number of files, eg:
tfilelist--iterate...
   |
onsubjobok
   |
tjava
on tJava, print the value of this global variable.
----------------------------------------------------------
Talend | Data Agility for Modern Business