Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP
Jennell_McIntire
Employee
Employee

Do you know the difference between the RecNo() and the RowNo() functions?  You may think that you can use these interchangeably to count the records or rows in a table but these functions differ slightly.  The RecNo() function will return an integer for the record currently being read from the source table starting with number one.  The RowNo() function also returns an integer but it represents the position of the row in the resulting QlikView internal table.  So while RecNo() counts from the source table, RowNo() counts from the resulting table.

In the script below the fields from the Temp table are loaded along with fields to represent the RecNo and the RowNo.  A Where clause is used to load all records where Number does not equal 3.

script.png

The resulting table below shows the results of this script.  In the RecNo field we see values 1 through 10 excluding 3.  This is because the script excluded records where Number = 3 so while that record was read, it was excluded from the results.  In the RowNo field we see values 1 through 9 for the position of each row in the results table.  The fact that some rows were excluded does not affect the RowNo field because we are only looking at the internal table that is created.  The RecNo field indicated the order in which the records were read from the source table and the RowNo field indicates the positon of the record in the internal table.

table.png

To see an example, check out my technical brief that includes the QVW and detailed descriptions of these functions.  In the technical brief, I also discuss the IterNo() function and the FieldValueCount() functions.

Jennell

13 Comments