Warehouse::SwapKey (Interface: Warehouse)
 
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
CreateWarehouse
SeekBySysNum
GetDBStatus
GetNext
The possible keys (and their numerical value) can be found in the SeekBy-methods of this interface.
 
Samples
 
C++
 
// Seek the warehouse card with system number 56
if (pWarehouse->SeekBySysNum (smEqual, 56))
{
    // Swap the key to 'WRH_COD' (1), positioning by warehouse code
    pWarehouse->SwapKey (1);
    // Navigate through the file using the key 'WRH_COD'
    while (pWarehouse->GetDBStatus () == 0)
    {
        // Process record data
        
        pWarehouse->GetNext ();
    }
}

C#
 
// Seek the warehouse card with system number 56
if (oWarehouse.SeekBySysNum (eSeekMode.smEqual, 56))
{
    // Swap the key to 'WRH_COD' (1), positioning by warehouse code
    oWarehouse.SwapKey (1);
    // Navigate through the file using the key 'WRH_COD'
    while (oWarehouse.GetDBStatus () == 0)
    {
        // Process record data
        
        oWarehouse.GetNext ();
    }
}

VBS
 
' Seek the warehouse card with system number 56
If oWarehouse.SeekBySysNum(smEqual, 56) Then
    ' Swap the key to 'WRH_COD' (1), positioning by warehouse code
    Call oWarehouse.SwapKey(1)
    ' Navigate through the file using the key 'WRH_COD'
    While oWarehouse.GetDBStatus() = 0
        ' Process record data
        
        Call oWarehouse.GetNext()
    Wend
End If

VB.NET
 
' Seek the warehouse card with system number 56
If oWarehouse.SeekBySysNum(eSeekMode.smEqual, 56) Then
    ' Swap the key to 'WRH_COD' (1), positioning by warehouse code
    oWarehouse.SwapKey(1)
    ' Navigate through the file using the key 'WRH_COD'
    While oWarehouse.GetDBStatus() = 0
        ' Process record data
        
        oWarehouse.GetNext()
    End While
End If