sx_KeyData

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_KeyData

VB Declaration

Declare Function sx_KeyData Lib "Apollo9.dll" () As String  

C Declaration

LONG FAR PASCAL sx_KeyData (VOID);

Description

Extracts the key data from the current index key in the current index and returns it as a string.

Return Value

Numeric keys return a string representation of the number to four decimal places. Logical keys return 'T' or 'F'. Date key return values differ according to the index type. NTX dates are returned as a string in CCYYMMDD format. IDX/CDX/NSX dates are returned as a string representation of the Julian date (see sx_GetDateJulian) - unless they have been turned into strings with DTOS().

VB Example

iDBF = sx_Use( "c:\data\test.dbf", "test", EXCLUSIVE, SDEFOX )

iOrd = sx_Index( "test.idx", "Upper(STATE+CITY)", IDX_NONE, False, &0 )

sx_GoTop

Edit1.Text = sx_KeyData ' (Contains "AKANCHORAGE ")

C Example

/*

Maintain our own user defined conditional index.

Add or Delete all of the records to the RYO index "CUSTOM" that match the cpLastName parameter based on the bAdd parameter. Assume that there is an index called "LAST".

*/

 

Void MaintainCustom(BYTEP cpLastName, BOOL bAdd)

{

SHORT iCurOrder;

 

//Save the currently active order

iCurOrder = sx_IndexOrd();

if (bAdd) //Are we adding a key?

{

//Set the order to the "Last" tag

sx_SetOrder(sx_TagArea("LAST")):

sx_Seek(cpLastName);

while (!memcmp(cpLastName, sx_KeyData(), strlen(cpLastName)))

{

sx_KeyAdd("CUSTOM");

sx_Skip(1);

}

//Restore the order

sx_SetOrder(iCurOrder);

}

else

{

//Set the order to the custom index

sx_SetOrder(sx_TagArea("CUSTOM"));

while (sx_Seek((BYTEP)"Smith"))

{

sx_KeyDrop((BYTEP)caTagName);

}

//Reset the order

sx_SetOrder(iCurOrder);

}

return;

}

See Also

sx_IndexKey