table.FETCH_EOF Function

Syntax

EOF_Found_Flag as L = Fetch_Eof()

Description

The <TBL>.FETCH_EOF() method returns TRUE (.T.) if the most recent fetch in the table or set referenced by the <TBL> object pointer has tried to read past the end of the file, creating an end of file condition. The meaning of end of file differs depending on how the records are currently arranged through the primary index, active range, or current query list. The end of file condition occurs when trying to read beyond the first or last physical record (in record number order), or beyond the first or last record in the current ordering and selection of records.

Example 

This script stores up to 1000 customer names in an array.

dim tbl as P
dim rec_num as N
dim i as N
tbl = table.current()
'Get number of records in table
rec_num = tbl.records_get()
if rec_num > 1000 then
    rec_num = 1000
end if
dim names[rec_num] as C
i = 1
tbl.fetch_first()
while .NOT. tbl.fetch_EOF()
    Names[I] = tbl.last_name
    i = i + 1
    tbl.fetch_next()
end while

A more efficient method for moving records into an array is <TBL>.POPULATE_GRID().

See Also