table.FETCH_LOC_PREV Function

Syntax

Located_Flag as L = Fetch_Loc_Prev(C pattern,C fieldname)

Arguments

pattern

An expression that specifies the field value to find.

fieldname

Optional. Default = all fields. The name of a single field to search.

Description

Locate the previos value/pattern if the field specified.

Discussion

The <TBL>.FETCH_LOC_PREV() method retrieves the previous record in the table referenced by <TBL> with a field value equal to the Matching_Expression. The search starts with the current record (or the previous record if the current record was found by a <TBL>.FETCH_LOC_PREV()and continues through each previous record until it reaches the first record in the active range, index, or query list. When <TBL>.FETCH_LOC_PREV()finds a record with a matching field, it returns TRUE (.T.). If no exact match is found, the result is FALSE (.F.). If <TBL>.FETCH_LOC_PREV()does not find a match, the record pointer is not moved. <TBL>.FETCH_LOC_PREV()is not case sensitive. <TBL>.FETCH_LOC_PREV()searches for any occurrence of the Matching_Expression. For example, if the Matching_Expression evaluates to "software", and a particular record contains "Alpha Software Corporation", a match is found. Searches performed using the FETCH_LOC_PREV() method can be slow in large tables because each record must be fetched and scanned. Lightning Query Optimization cannot be used to optimize the search. If the field you want to search is indexed, and the value you want to find is at the start of the field, you should consider using the <TBL>.FETCH_FIND() method.

Example 

Refer to <TBL>.FETCH_LOC_NEXT().

See Also