xHarbour Reference Documentation > Function Reference |
Sets focus to the controlling index in a work area
OrdSetFocus( [<nOrder>|<cIndexName>], ; [<cIndexFile>] ) --> cOldIndexName
The function returns the symbolic name of the controlling index that is selected before the function is called. If no index is open, the return value is an empty string ("").
The OrdSetFocus() function selects an index open in a work area as the "controlling" index. Many indexes can be open in a work area, but only one index can have focus. This index determines the logical order how records stored in a database can be accessed and/or are visible in the current work area.
If an open index is specified with <nOrder> or <cIndexName>, this index is becomes the controlling index and the returnvalue is the name of the previous controlling index.
Calling OrdSetFocus() without a parameter yields the current controlling index.
See also: | Alias(), DbSetOrder(), INDEX, OrdFor(), OrdKey(), OrdName(), OrdNumber(), SET INDEX |
Category: | Database functions , Index functions |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example creates two indees in one index file and displays // the result of OrdSetFocus(). The contents of the first logical // records resulting from both indexes illustrates the index change. REQUEST DbfCdx PROCEDURE Main USE Customer VIA "DbfCdx" INDEX ON Upper( LastName ) TAG Last TO Customer INDEX ON Upper( FirstName ) TAG First TO Customer ? OrdSetFocus() // result: FIRST DbGotop() ? Lastname, Firstname // result: Feldman Allen ? OrdSetFocus(1) // result: FIRST DbGotop() ? Lastname, Firstname // result: Alberts Cathy ? OrdSetFocus( "First" ) // result: LAST DbGotop() ? Lastname, Firstname // result: Feldman Allen USE RETURN
http://www.xHarbour.com