<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_Seek |
Declare Function sx_Seek Lib "Apollo9.dll"
(ByVal cpKeyValue As String)
As Integer
BOOL FAR PASCAL sx_Seek
(BYTEP cpKeyValue);
Searches the current order for a supplied key.
cpKeyValue: The value to search for. If the key is numeric, transform it to a string before passing it to sx_Seek. The string will be transformed back to a number before performing the seek. Dates must be passed as strings in DTOS form (CCYYMMDD). Pass search keys to logical indexes as "T" or "F".
If elements of the key were created with the xBase DESCEND() function, use sx_Descend to invert the key before passing it to sx_Seek.
The search key value may be a partial key (if sx_SetExact is not True).
True if the key was found and False if not. If the return is False, sx_Found will be False and sx_Eof will be True.
The following conditions apply depending on the settings of sx_SetExact and sx_SetSoftSeek:
•A complete match in both value and length always returns True. sx_Found will be True and sx_Eof will be False.
•A partial match will return True if sx_SetExact is False. sx_Found will be True and sx_Eof will be False.
•A partial match will return False if sx_SetExact is True and sx_SetSoftSeek is False (if sx_SetSoftSeek is True, it overrides any sx_SetExact setting).
•If sx_SetSoftSeek is False and the key is not found, False is returned.
•If sx_SetSoftSeek is True and a key is found that is greater than the requested key, sx_Seek returns True, sx_Found returns False, and sx_Eof returns False.
•If sx_SetSoftSeek is True and EOF is encountered without finding any key, False is returned.
Sub ButtonSeek_Click ()
RecStr$ = InputBox$("Seek Key?", "Seek", "")
If RecStr$ = "" Then Exit Sub
RecStr$ = UCase$(RecStr$)
sx_SetSoftSeek True
If sx_Seek(RecStr$) Then
If sx_Found() Then
MsgBox "Exact or partial match!"
Else
MsgBox "Soft seek - on record after"
End If
Call sx_GetRecord(lRec)
BoxCust.Text = lRec.lCust
Else
MsgBox "Key Not Found"
ButtonTop_Click
End If
sx_SetSoftSeek False
End Sub
sx_SetSoftSeek(TRUE);
if (sx_Seek(cpKey))
{
if (sx_Found())
AfxMessageBox((LPCSTR) "Exact or partial match!");
else
AfxMessageBox((LPCSTR) "Soft seek - on record after");
sx_GetRecord(cpRecord);
}
else
AfxMessageBox((LPCSTR) "Key Not Found");
sx_SetSoftSeek(FALSE);
sx_Descend, sx_Found, sx_SeekBin, sx_SetExact, sx_SetSoftSeek