Function: Recno
Description
Returns the record number of a record in the table. You can think of the record number as the detail line number, since any given record number will always correspond to the same detail line from the report (e.g., Recno=1 always corresponds to the first detail line extracted from the report, and Recno=12 always corresponds to the 12th detail line, etc.). This applies even if the table has been sorted. This is not the case for the row numbers that you see at the left edge of the table.
Syntax
Recno()
Arguments
None.
Return value
This function returns a number.
Calculated field example
The following expression creates a calculated field which displays the record number for each record in the table. Recno()
Filter/Find example
Records 20 - 25 can be selected or found using the expression: Recno()>=20.And.Recno()<=25
Every third record can be returned by using the expression: Recno()/3=Int(Recno()/3)
RecNo versus RowNo
RecNo is a filter-insensitive row number, whereas RowNo is a filter-sensitive row number.
Essentially, if you filtered a dataset with 10 rows down to 5 rows, with RecNo you might see something like:
2
4
6
7
11
With RowNo, you would see:
1
2
3
4
5
Note that in DPS, RecNo refers to the line number from the table node on which the formula is being evaluated before any changes (like filters) are applied to the node.
This means that if you create a sort, for example, a call to RecNo from a formula in that sort's change list would mean the number of the row before any of the changes were applied on top of that sort.
Likewise, RowNo starts as a sequential line number on each new table node. Its value would be evaluated differently depending on what filter changes exist before it in the node on which the formula is being evaluated.
This means that if you make a sort, for example, a call to RowNo from a formula in that sort's change list would mean the number of the row after eliminating rows which are filtered out by a filter before the RowNo call in that node's change list.