Lookup::SwapKey (Interface: Lookup)
 
Swaps the file to another key.
 
VARIANT_BOOL SwapKey (
    SHORT sKeyNum
)
 
Parameters
sKeyNum
[in] The number of the key by which you want the file positioned.
 
Return value
True if the file was positioned according to the given key, otherwise false (e.g. if the current record is a null value for the given key or if an invalid sKeyNum was supplied).
 
See Also
CreateLookup
SeekBySysNum
GetDBStatus
GetNext
The possible keys (and their numerical value) can be found in the SeekBy-methods of this interface.
 
Samples
 
C++
 
// Seek the record with system number = 56
pLookup->SeekBySysNum (smEqual, 56);
// Swap the key to 'LKP_TYP' (1), positioning by the type number
if (pLookup->GetDBStatus () == 0)
    pLookup->SwapKey (1);
// Navigate through the file using the key 'LKP_TYP'
while (pLookup->GetDBStatus () == 0)
{
    // Process record data

    pLookup->GetNext ();
}

C#
 
// Seek the record with system number = 56
oLookup.SeekBySysNum (eSeekMode.smEqual, 56);
// Swap the key to 'LKP_TYP' (1), positioning by the type number
if (oLookup.GetDBStatus () == 0)
    oLookup.SwapKey (1);
// Navigate through the file using the key 'LKP_TYP'
while (oLookup.GetDBStatus () == 0)
{
    // Process record data

    oLookup.GetNext ();
}

VBS
 
' Seek the record with system number = 56
Call oLookup.SeekBySysNum(smEqual, 56)
' Swap the key to 'LKP_TYP' (1), positioning by the type number
If oLookup.GetDBStatus() = 0 Then
    oLookup.SwapKey(1)
' Navigate through the file using the key 'LKP_TYP'
While oLookup.GetDBStatus() = 0
    ' Process record data

    Call oLookup.GetNext()
Wend

VB.NET
 
' Seek the record with system number = 56
oLookup.SeekBySysNum(eSeekMode.smEqual, 56)
' Swap the key to 'LKP_TYP' (1), positioning by the type number
If oLookup.GetDBStatus() = 0 Then
    oLookup.SwapKey(1)
' Navigate through the file using the key 'LKP_TYP'
While oLookup.GetDBStatus() = 0
    ' Process record data

    oLookup.GetNext()
End While