Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - seek search an index for a matching record http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 seek                Search an index for a matching record
------------------------------------------------------------------------------
 Syntax
   [!sAlias] seek xExpr

 Arguments
   sAlias is the database to operate on.
   xExpr is an expression specifying the search criteria.

 Description
   The seek command searches the controlling index of a database file for
   the first record matching the expression xExpr.

   If seek does not find the matching record, then eof() returns .t..
   Character searches respect the status of the set exact flag.

   The data type of the seek expression and the index expression used to
   generate the index file must match. For character data, the size of the
   data must match.

   If the system variable __soft_seek is .t., then the record pointer is
   positioned at the first record that fails the seek rather than at the end
   of the file.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   proc Test_seek
   vardef
      char cName
   enddef
   input "Last name: " to cName
   open sTest index sIdxLN
   seek cName
   if found()
      ? "First name for", cName, "is", sTest->firstname
   else
      ? "Name", cName, "is not found in database"
   endif
   endproc

   proc main
   Test_seek()
   endproc

See Also: __soft_seek find locate set exact

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