ApiIndexChangeDirection - cDbUpdateFunctionLibrary

To set the sort direction of an index segment.


Type: Function


Parameters: Handle hTable, Integer iIndex, Integer iSegment Integer iDirection

Parameter

Description

hTable

The table number as referenced to by Filelist.cfg

iIndex

Number of the index

iSegment

The index segment number

iDirection

DF_ASCENDING, DF_DESCENDING


Syntax


Function ApiIndexChangeDirection Handle hTable Integer iIndex Integer iSegment Integer iDirection Returns Boolean

Call:

Get ApiIndexChangeDirection Customer.File_Number 2 2 True to bOK



Description

Use it to change an index direction to ascending or descending. Important: Applies only to the embedded database (*.dat tables)


Remarks


If DF_INDEX_SEGMENT_DIRECTION is set to DF_DESCENDING, the index segment will rank from high to low rather than the default low to high. Individual segments (columns) of an index can be designated as descending or ascending. Index segments designated descending can be very useful, but can impose certain requirements on programming. For example, when a find gt (greater than) function is executed on an index containing descending segments, the gt operates as an lt (less than).


Example


Procedure OnUpdate

    Boolean bOK

   

    Get ApiIndexChangeDirection Customers.File_Number Index.2 2 DF_ASCENDING to bOK   


End_Procedure