Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Advantage CA-Clipper Guide v6.11 - search for http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SEARCH FOR
 Fill an array with record numbers meeting a condition
------------------------------------------------------------------------------

 Syntax

     SEARCH FOR <lCondition> TO <aVar>

     FOR <lCondition> specifies a logical condition to limit the record
     numbers stored into the target array.  Clinet Advantage Optimized
     Filters will optimize any FOR condition that contains one or more
     active index keys.

     TO <aVar> specifies the name of the destination target array into
     which the record numbers are stored.  The maximum size of this array
     is 4096 elements.

 Description

     The SEARCH FOR command fills an array with record numbers for records
     meeting a logical FOR condition.  Record numbers will be stored into
     the target array in natural record order.  If the Client Advantage
     Optimized Filter engine is unable to optimize the FOR condition, a
     natural record order scan of the table will be used to fill the target
     array.

     Note:  SEARCH FOR is a Client Advantage Optimized Filter command.
     The command is only available if you link the Client Advantage Optimized
     Filter library, AOF.LIB, into your application and you #include the
     AOF.CH header file in your source code.

 Example

     // Must include AOF.CH in your source code to make the SEARCH FOR
     //   command available.
     #include "AOF.CH"

     LOCAL nCount, nRecs, aTemp

     // Assume index has single field key expression
     USE account INDEX state VIA "DBFCDXAX"

     CLEAR SCREEN
     ? "Example of SEARCH command."
     ?

     // Search command optimized using state index
     SEARCH FOR account->state = "FL" TO aTemp
     nRecs := Len( aTemp )

     ? "Record", "First", "Last"
     FOR nCount := 1 TO nRecs
        GOTO aTemp[ nCount ]
        ? recno(), account->first, account->last
     NEXT

     CLOSE ALL


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