Get the key value of the current record from the controlling order

     ORDKEYVAL() --> uKeyValue


     ORDKEYVAL() returns the current record's key value.  The data type of
     the return value is the same as that of the key expression used to
     create the order.  Use VALTYPE() to determine the data type.

     ORDKEYVAL() returns NIL if:

     .  There is no controlling order

     .  The record pointer is at the end of file (EOF() returns true

     .  There is no key defined for this record (for example, you have
        positioned the record pointer to a record that does not meet the
        order's for condition or that lies outside of its specified scope)


     The key value is retrieved from the controlling order, not the database
     file.  This makes the retrieval faster because no time is spent reading
     in the actual record.

     Tip:  ORDKEYVAL() is fast, but if you are going to use the value
     more than once, it is faster to store the result in a local variable.
     Then use the local variable rather than calling ORDKEYVAL() repeatedly
     for the same record.

     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.


     .  This example displays the values for all keys in an order
        without ever reading the individual records into memory:

           LOCAL cKey, cFirst, cLast

           USE Customer
           // Assuming both LastName and FirstName are
           // 20 characters
           INDEX ON LastName + FirstName TO LastFir

           DO WHILE !Customer->EOF()
              cKey := Customer->ORDKEYVAL()          // Get key
                                                     // value
              cLast := LEFT(cKey, 20)                // Get last
                                                     // name
              cFirst := RIGHT(cKey, 20)              // Get first
                                                     // name
              ? cLast, cFirst


 Files   Library is CLIPPER.LIB.

See Also: ORDSCOPE()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.