Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
JavierP2
Contributor
Contributor

Create CSV files with number of rows of other CSV file

Hi community,

I do need to create a csv file with a colunm with the number of rows from other csv.

I'm able to get the number of rows using tfilerowcount - tjava System.out.println(globalMap.get("tFileRowCount_1_COUNT"));

but i dont know how to pass this variable to a tfileoutputdelimited so i can create a csv file with a colum called rowcount and the number.

i suppose this is easy but i dont know how to do it, any suggestions?

thanks a lot.

Labels (2)
3 Replies
Anonymous
Not applicable

Add a new column in the output table on tMap before tFileOutputDelimited, set the expression of column as:

((Integer)globalMap.get("tFileRowCount_1_COUNT"))

JavierP2
Contributor
Contributor
Author

Hi shong, thanks for the help, i'm trying to do that but i have no result.

 

my talend is.

 

tfilerowcount_1 (with the csv file attached to the tfilerow) - main connection - tmap_1 (no colums on the left side and in the right side i have your expression in a colum called rowcount) - main connection - tfileoutputdelimited (with the name of the resultant csv).

 

what i'm doing wrong?

 

0695b00000rdUcgAAE.png0695b00000rdUrtAAE.png 

Anonymous
Not applicable

@Javier Palomares​ the global variable should be used in next subjob, change your job to:

tFileRowCount

|onsubjobok

tFixedFlowInput (or any input component)--main--tMap--tFileOutputDelimeted.