Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tMap - How do i know if I am on the last row?

I need to know if I am on the last row in a tmap to perform logic.  Is there an flag any where that I can use?  I was thinking of counting the rows in the file before the tMap and maintain a counter within.

Labels (2)
1 Reply
Anonymous
Not applicable
Author

Hi  
No a direct way to know it, you can count the rows first, and then add a sequence id to each row in the next subjob, for example:
tfileinputDelimited1--main---tJavaRow
    |
onsubjobok
    |
tfileinputDelimited2--main--tMap-->

there is a global variable defined on tfileinputdelimited1 to store the total number of rows are read from the file:
((Integer)globalMap.get("tFileInputDelimited_1_NB_LINE"))

on tMap: add a new column as row number, set its expression as: Numeric.sequence("s1",1,1)

Regard
Shong