Click or drag to resize

SetSoftSeek Function (Logic)

X#
Return and optionally change the setting that determines whether a seek operation will find a close match when no exact match is found.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION SetSoftSeek(
	lNewSetting AS LOGIC
) AS LOGIC
Request Example View Source

Parameters

lNewSetting
Type: Logic
TRUE moves the record pointer to the next record with a higher key after a failed order search; FALSE moves the record point to the end of the file after a failed order search.
The initial default is FALSE.

Return Value

Type: Logic
If lNewSetting is not specified, SetSoftSeek() returns the current setting.
If lNewSetting is specified, the previous setting is returned.
Remarks
SetSoftSeek() enables relative seeking, a method of searching an order and returning a record even if there is no match for a specified key. When TRUE is specified and a match for a seek operation (for example, the SEEK command or DBSeek() function) is not found, the record pointer is set to the next logical record with a higher key value than the seek argument. Records not visible (because of DBSetFilter(), SetDeleted(), or a conditional controlling order) are skipped when searching for the next higher key value.
If there is no record with a higher key value, the record pointer is positioned at LastRec() + 1, EOF() returns TRUE, and Found() returns FALSE. Found() returns TRUE only if the record is actually found.
It never returns TRUE for a relative find. When FALSE is specified and a seek operation is unsuccessful, the record pointer is positioned at LastRec() + 1, EOF() returns TRUE, and Found() returns FALSE.
Examples
This example starts relative seeking at the beginning of a routine and stops it at the end of the routine:
X#
1LOCAL lSSSetting AS LOGIC
2lSSSetting := SetSoftSeek(TRUE)
3SEEK UPPER("CarlM")
4? Found()            // FALSE
5? EOF()            // FALSE
6? cName            // CarlT
7SetSoftSeek(lSSSetting)
See Also