Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Mach SIx v1.1c - Reference Guide - <b>search for - fills array with record numbers for a condition</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  SEARCH FOR       - Fills array with record numbers for a condition
-------------------------------------------------------------------------------

  Syntax:

  SEARCH FOR <lCondition> TO <aVar>

  Arguments:

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

  TO <aVar> specifies the name of target array to store the resulting record
  numbers into.

  Description:

  The SEARCH FOR command fills an array with record numbers for records
  meeting a logical FOR condition.  Record numbers will always be stored
  into the target array in natural record order.  If Mach SIx is unable to
  optimize the FOR condition, a top down scan of the database will be used
  to fill the target array.

  ---------------------------------| EXAMPLE |--------------------------------
  /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  *  Demonstrates the SEARCH command                                        *
  *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/

  #include "DBFSIX.CH"
  #include "MACHSIX.CH"

  Local nCount, nRecs, aTemp

  USE Account VIA "DBFSIX"  // Structural index ACCOUNT.CDX opened
                            // automatically
  CLEAR SCREEN
  ? "Example of SEARCH command."
  ?

  // Search command optimized using state index.
  SEARCH FOR account->STATE = "CA" TO aTemp
  nRecs:=len( aTemp )

  ? "Record", "First", "Last"
  FOR nCount:=1 to nRecs
    GOTO aTemp[ nCount ]
    ? recno(), field->FIRST, field->LAST
  NEXT nCount
  CLOSE ALL


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