<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_Descend |
Declare Function sx_Descend Lib "Apollo9.dll" ()
(ByVal cpKeyString As String)
As String
LONG FAR PASCAL sx_Descend(BYTEP cpKeyString);
Converts a key string into a 2s complement representation for use in seeking on an index built with the DESCEND xBase function.
cpKeyString: The search string you wish to convert into its descending form.
The passed search key is returned as a string in 2s complement form. If an index has been built using the DESCEND xBase function, a key for use with sx_Seek must be converted before the search takes place.
' index is in descending sequence so we will
' invert when seeking
RecStr$ = InputBox$("Seek Key?", "Seek", "")
If RecStr$ = "" Then Exit Sub
RecStr$ = UCase$(RecStr$)
If sx_Seek(sx_Descend(RecStr$)) Then
DisplayRec
Else
MsgBox "Key not found"
End If
// seek descending index key
void CNamesForm::OnKeypressSdebrowse1(UINT, int, CWnd*, LPVOID lpParams)
{
BYTE caSearchKey[2];
SHORT iNewKey = 0;
SHORT iKeyAscii = AFX_NUM_EVENTPARAM(short, lpParams);
// quick search on first char if normal character
if (iKeyAscii > 31 && iKeyAscii < 127)
{
// set up the search string and convert to
// uppercase because our index expression
// is "descend(upper(name))"
caSearchKey[0] = (UBYTE) iKeyAscii;
caSearchKey[1] = '\0';
AnsiUpper((LPSTR) caSearchKey);
// invert key and seek for the first name that begins with
// the entered character
m_sdebrowse->SetStrProperty("SearchKey",
(LPSTR) sx_Descend(caSearchKey));
// BEEP if not found
if (!m_sdebrowse->GetNumProperty("Action"))
MessageBeep(-1);
}
m_sdebrowse->SetFocus();
return;
}