Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Comix 3.0 Reference Manual - <b>cmxkeyval()</b> get current key value from master index http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
cmxKeyVal()           Get current key value from master index
------------------------------------------------------------------------------

Synopsis

    cmxKeyVal() -> xVal

Arguments

    None.

Returns

    Current key value (same data type as key for master index).

    Returns NIL if:

    o   No master index (in natural order)

    o   At EOF()

    o   There is no key for this record (e.g., in a conditional index after
        you GOTO a non-matching record).

Description

    cmxKeyVal() gets the value of the current key from the master index.
    This value is retrieved directly from the index (_not_ from the
    database).

    The advantage of this is that the value can be obtained without reading
    in the actual record (so no time is spent reading in the record).


Tip

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


Example

    local cKey, cFirst, cLast

    use demo
    index on last+first to lastFir      && Last is 20 characters & first
                                        && is 20 characters
    ...

    use demo
    set index to lastFir
    do while !eof()
        cKey := cmxKeyVal()             && Get the key value
        cLast := left(cKey, 20)         && Extract last name from it
        cFirst := right(cKey, 20)       && Extract first name from it
        ? cLast, cFirst                 && Now print it out (didn't even
                                        && read in the record!)
        skip
    enddo

See Also

    None.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson