table.FETCH_NEXT Function

Syntax

Found_Flag as N = Fetch_Next([fetch level])

Arguments

Found_Flag

The return value is zero if a record was found. A non-zero value indicates that a record was not found.

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 next record in the table/set. returns TRUE if record found.

Discussion

The <TBL>.FETCH_NEXT() method retrieves the next record in the table or set referenced by <TBL>. The next record is determined by the active range, index, or query list. If there is no next record to be fetched, the method returns a value other than zero. Use the <TBL>.FETCH_EOF() method after every <TBL>.FETCH_NEXT()to determine if the method has tried to fetch beyond the active range and index. In most cases, the last current record is preserved when a <TBL>.FETCH_NEXT()fails. 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 Fetch at a particular level in a set. Note : <TBL>.FETCH_NEXT()sets the EOF flag when it reads the last record in the table.

Example 

This script is attached to a button. It marks all selected records. For faster processing, use <TBL>.BATCH_BEGIN() and <TBL>.BATCH_END( ).

dim tbl as P
tbl = table.current()
tbl.fetch_first()
tbl.batch_begin()
while .NOT. tbl.fetch_eof()
    tbl.change_begin()
    tbl.mark()
    tbl.change_end(.T.)
    tbl.fetch_next()
end while
tbl.batch_end()
parent.resynch()

See Also