C5_ORDKEYGOTO

 ORDKEYGOTO()
 Move to a record specified by its logical record number in the controlling
 order
------------------------------------------------------------------------------
 Syntax

     ORDKEYGOTO(<nKeyNo>) --> lSuccess

 Arguments

     <nKeyNo> is the logical record number.  If the value specified does
     not satisfy the scope or for condition for the order, the record pointer
     is positioned at the end of file.

 Returns

     ORDKEYGOTO() returns true (.T.) if successful; otherwise, it returns
     false (.F.).

 Description

     ORDKEYGOTO() is the complement to ORDKEYNO().  ORDKEYNO() returns the
     logical record number (i.e., its position in the controlling order) of
     the current record, and ORDKEYGOTO() moves the record pointer to the
     specified logical record.

     Tip:  This function can be useful when displaying scroll bars.  If
     the user clicks on a certain position on the scroll bar, you can move to
     the corresponding record by calling ORDKEYGOTO().

     By default, this function operates on the currently selected work area.
     It will operate on an unselected work area if you specify it as part of
     an aliased expression.

 Examples

     .  This example shows the difference between physical and logical
        record number:

        USE Customer
        SET INDEX TO First   // Make records in first name
                             // order
        ORDKEYGOTO(100)      // Go to the 100th logical record
        ? RECNO()            // Returns the physical record
                             // number
        ? ORDKEYNO()         // Returns 100, the logical
                             // record no

 Files   Library is CLIPPER.LIB.

See Also: ORDKEYCOUNT() ORDKEYNO()

 

OrdWildSeek()

OrdWildSeek()

Searches a value in the controlling index using wild card characters.
Syntax : OrdWildSeek( <cWildCardString>,; 
                      [<lCurrentRec>] , ;
                      [<lBackwards>] ) --> lFound

Arguments :

<cWildCardString> :

This is a character string to search in the controlling index. It may include 
the wild card characters "?" and "*". The question mark matches a single 
character, while the asterisk matches one or more characters.

<lCurrentRec> :

This parameter defaults to .F. (false) causing OrdWildSeek() to begin the 
search with the first record included in the controlling index. When .T. 
(true) is passed, the function begins the search with the current record.

<lBackwards> :

If .T. (true) is passed, OrdWildSeek() searches <cWildCardString> towards 
the begin of file. The default value is .F. (false), i.e. the function 
searches towards the end of file. 

Return :

The function returns .T. (true) if a record matching <cWildCardString> is 
found in the controlling index, otherwise .F. (false) is returned.

Description :

OrdWildSeek() searches a character string that may include wild card 
characters in the controlling index. This allows for collecting subsets 
of records based on an approximate search string. Records matching the 
search string are found in the controlling index, and the record pointer 
is positioned on the found record.

When a matching record is found, the function Found() returns .T. (true) 
until the record pointer is moved again. In addition, both functions, 
BoF() and EoF() return .F. (false).

If the searched value is not found, OrdWildSeek() positions the record 
pointer on the "ghost record" (Lastrec()+1), and the function Found() 
returns .F. (false), while Eof() returns .T. (true). The SET SOFTSEEK 
setting is ignored by OrdWildSeek().

Info :

See also: DbSeek(), LOCATE, OrdFindRec(), OrdKeyGoto(), WildMatch()

Category: Database functions, Index functions, extensions

Example :

// The example uses two wildcard search strings to show
// possible search results of OrdWildSeek()

PROCEDURE Main
   LOCAL aCust := {}

   USE Customer
   INDEX ON Upper(LastName) TO Cust01

   DO WHILE OrdWildSeek( "*MAN?", .T. )
     AAdd( aCust, FIELD->Lastname )
   ENDDO

   AEval( aCust, {|c| QOut(c) } )
   // Found records:
   // Dormann
   // Feldman

   GO TOP
   aCust := {}
   DO WHILE OrdWildSeek( "*EL*", .T. )
      AAdd( aCust, FIELD->Lastname )
   ENDDO

   AEval( aCust, {|c| QOut(c) } )
   // Found records:
   // Feldman
   // Hellstrom
   // Keller
   // Reichel
   USE
RETURN

Note : Harbour has this function without documentation. This page borrowed 
from xHarbour and not tested. Please beware about Unicode.

C5 Index Commands and Functions

Index Commands and Functions

Commands :

DELETE TAG :

Delete a Tag

DELETE TAG <cOrderName> [IN <xcOrderBagName>]
    [, <cOrderName> [IN xcOrderBagName] list>]

INDEX ON … :

Create an index file

INDEX ON <expKey>
    [TAG <cOrderName>]
    TO <xcOrderBagName>
    [FOR <lCondition>] [ALL]
    [WHILE <lCondition>]
    [NEXT <nNumber>]
    [RECORD <nRecord>]
    [REST]
    [EVAL <bBlock>
    [EVERY <nInterval>]
    [UNIQUE]
    [ASCENDING|DESCENDING]

REINDEX :

Rebuild open indexes in the current workarea

REINDEX
    [EVAL <lCondition>]
    [EVERY <nRecords>]]

SET INDEX

Open index file(s) in the current work area

SET INDEX TO [<xcIndex list>]

SET ORDER

Set a new controlling index

SET ORDER TO [<nOrder> | [TAG <cOrderName>]
    [IN <xcOrderBagName>]]>

SET UNIQUE* : 

Toggle the inclusion of nonunique keys into an index

SET UNIQUE on | OFF | <xlToggle>

Functions :

DBCLEARINDEX() :

Close all indexes for the current work area

DBCLEARINDEX() --> NIL

DBCREATEINDEX() :

Create an index file

DBCREATEINDEX( <cIndexName>, <cKeyExpr>,
    <bKeyExpr>, 
    [<lUnique>] ) --> NIL

DBREINDEX() : 

Recreate all active indexes for the current work area

DBREINDEX() --> NIL

DBSEEK() : 

Move to the record having the specified key value

DBSEEK( <expKey>, [<lSoftSeek>] ) --> lFound

DBSETINDEX() : 

Open an index for the current work area

 DBSETINDEX( <cIndexName> ) --> NIL
 DBSETINDEX( <cOrderBagName> ) --> NIL

DBSETORDER() : 

Set the controlling order for the current work area

DBSETORDER( <nOrderNum> ) --> NIL

DESCEND() : 

Return a descending index key value

DESCEND( <exp> ) --> ValueInverted

FOUND() : 

Determine if the previous search operation succeeded

FOUND() --> lSuccess

INDEXEXT() : 

Return the default index extension

INDEXEXT() --> cExtension

INDEXKEY() : 

Return the key expression of a specified index

INDEXKEY( <nOrder> ) --> cKeyExp

INDEXORD() : 

Return the order position of the controlling index

INDEXORD() --> nOrder

ORDBAGEXT() :

Return the default Order Bag RDD extension

ORDBAGEXT() --> cBagExt

ORDBAGNAME() :

Return the Order Bag name of a specific Order

ORDBAGNAME(<nOrder> | <cOrderName>) --> cOrderBagName

ORDCOND()

Specify conditions for ordering

ORDCOND([FOR <lCondition>]
             [ALL] [WHILE <;lCondition>]
             [EVAL <bBlock> [EVERY <nInterval>]]
             [RECORD <nRecord>] [NEXT <nNumber>]
             [REST] [DESCENDING])

ORDCONDSET()

Set the condition and scope for an order

     ORDCONDSET([<cForCondition>],
        [<bForCondition>],
        [<lAll>],
        [<bWhileCondition>],
        [<bEval>],
        [<nInterval>],
        [<nStart>],
        [<nNext>],
        [<nRecord>],
        [<lRest>],
        [<lDescend>],
        [<lAdditive>],
        [<lCurrent>],
        [<lCustom>],
        [<lNoOptimize>]) --> lSuccess

ORDCREATE():

Create an Order in an Order Bag

ORDCREATE(<cOrderBagName>,[<cOrderName>], <cExpKey>,

    [<bExpKey>], [<lUnique>]) --> NIL

ORDDESCEND()

Return and optionally change the descending flag of an order

ORDDESCEND([<cOrder> | <nPosition>],[<cIndexFile>],
            [<lNewDescend>]) --> lCurrentDescend

ORDDESTROY() :

Remove a specified Order from an Order Bag

ORDDESTROY(<cOrderName> [, <cOrderBagName> ]) --> NIL

ORDFOR() :

Return the FOR expression of an Order

ORDFOR(<cOrderName> | <nOrder>
    [, <cOrderBagName>]) --> cForExp

ORDISUNIQUE()

          Return the status of the unique flag for a given order

    ORDISUNIQUE([<cOrder> | <nPosition>],
        [<cIndexFile>]) --> lUnique

ORDKEY() :

Return the Key expression of an Order

ORDKEY(<cOrderName> | <nOrder>
 [, <cOrderBagName>]) --> cExpKey

ORDKEYADD()

Add a key to a custom built order

         ORDKEYADD([<cOrder> | <nPosition>],
            [<cIndexFile>],[<expKeyValue>]) --> lSuccess

 

ORDKEYCOUNT()

Return the number of keys in an order

         ORDKEYCOUNT([<cOrder> | <nPosition>],
              [<cIndexFile>]) --> nKeys

ORDKEYDEL()

Delete a key from a custom built order

        ORDKEYDEL([<cOrder> | <nPosition>],
            [<cIndexFile>],
            [<expKeyValue>]) --> lSuccess

ORDKEYGOTO()

Move to a record specified by its logical record number

ORDKEYGOTO(<nKeyNo>) --> lSuccess

ORDKEYNO()

 Get the logical record number of the current record

         ORDKEYNO([<cOrder> | <nPosition>],
             [<cIndexFile>]) --> nKeyNo

 ORDKEYVAL()

Get key value of the current record from controlling order

ORDKEYVAL() --> xKeyValue

 

ORDLISTADD() :

Add Order Bag contents or single Order to the Order List

ORDLISTADD(<cOrderBagName>
    [, <cOrderName>]) --> NIL

ORDLISTCLEAR() :

Clear the current Order List

ORDLISTCLEAR() --> NIL

ORDLISTREBUILD() :

Rebuild all Orders in the Order List of the current work area

ORDLISTREBUILD() --> NIL

ORDNAME() :

Return the name of an Order in the work area

ORDNAME(<nOrder>[,<cOrderBagName>])
    --> cOrderName

ORDNUMBER() :

Return the position of an Order in the current Order List

ORDNUMBER(<cOrderName>[, <cOrderBagName>]) --> nOrderNo

 ORDSCOPE()

Set or clear the boundaries for scoping key values

ORDSCOPE(<nScope>, [<expNewValue>]) --> uCurrentValue

ORDSETFOCUS() :

Set focus to an Order in an Order List

ORDSETFOCUS([<cOrderName> | <nOrder>]
    [,<cOrderBagName>]) --> cPrevOrderNameInFocus

ORDSETRELAT()

Relate a specified work area to the current work area

    ORDSETRELATION(<nArea> | <cAlias>,<bKey>, [<cKey>])

             --> NIL

ORDSKIPUNIQUE()

Move record pointer to the next or previous unique key

ORDSKIPUNIQUE([<nDirection>]) –> lSuccess