table.FETCH_LAST Function

Syntax

Found_Flag as L = Fetch_Last([fetch level])

Arguments

level

Optional. Used when fetching through the records of a set. The outline level determines the depth of the fetch, so that tables at lower levels in the set can be excluded from the Fetch operation.

Description

Fetch the last record in the table/set. returns TRUE if record found.

Discussion

The <TBL>.FETCH_LAST() method retrieves the last record in the table or set referenced by <TBL>. The last record is determined by the active range, index, or query list. If no records are selected by the current range, index, or query, and no last record is found, a value other than zero is returned. You use the optional Outline_Level_Number parameter when fetching through the records of a set. The outline level determines the depth of the fetch, so that tables at lower levels in the set can be excluded from the Fetch operation. This is useful for operations that relate to only parent records in a set. For more information, see Fetching Only Parent Records With Fetch Outlining.

Example 

Determines the customer number from the last record in primary index order.

dim tbl as P
tbl = table.current()
tbl.fetch_last()
last_cust_no = tbl.cust_no
trace.writeln("The last cust_no is: " + last_cust_no)

See Also