SetOrder

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

SetOrder

Declaration

function SetOrder( iIndex: Integer ): Integer;

Description

Selects an existing order as the controlling index order.

 

When compound indexes are opened (either automatically as structural indexes or explicitly via IndexOpen) there is no controlling order presumed. You must explicitly select an order with SetOrder.

Parameters

iIndex: This is the integer identifier of the order attached to this work area that is returned by IndexOpen, IndexOrd, Index, or TagArea. When using NTX and IDX indexes, this value should be retained in a global variable to ensure your ability to switch to this order when required.

The current order identifier may be retrieved with IndexOrd.

image\tip.gif If iIndex is passed as zero, all index orders are turned off and the table record sequence reverts to natural order.

Return Value

The previous index order identifier in use is returned. If zero, there was no previous index order in use.

Delphi Example

// open file and set order

ApTbl.Open;

iCustIndex1 := ApTbl.IndexOpen( 'c:\Apollo\Data\cust1.ntx' );

iCustIndex2 := ApTbl.IndexOpen( 'c:\Apollo\Data\cust2.ntx' );

iRetVal := ApTbl.SetOrder( iCustIndex1 );

C++Builder Example

// open file and set order

ApTbl->Open();

iCustIndex1 = ApTbl->IndexOpen( "c:\\Apollo\\Data\\cust1.ntx" );

iCustIndex2 = ApTbl->IndexOpen( "c:\\Apollo\\Data\\cust2.ntx" );

iRetVal = ApTbl->SetOrder( iCustIndex1 );

See Also

Index, IndexOpen, IndexOrd, TagArea, TagName