Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RaSQL/B 6.1a for Clipper - <b>n_xseek()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_XSEEK()
Retrieve record by index key

Syntax
N_XSEEK(<Segment1> [, <Segment2> ...])

RDD Option
SEEK or DBSEEK()

Argument
Specify key value as a series of <segment> values, separated by commas (,) 
one for each segment in the index.  Data type of each value should 
correspond to that of the segment (character, numeric, etc.). 

If the index is multi-segmented then you may specify up to <n> values, 
separated by commas (,) where <n> is the number of segments in the index. If 
you omit one or more segments, then the function attempts a match on the 
partial-key values provided. Note that you may omit segments only in reverse 
order, starting with the last segment.

For example,  if an index is made up of four segments: 
(LastName,FirstName,Initial,Title) then you can seek on (LastName,FirstName) 
but not, say,  (LastName,Title).

If a segment is a character type (C, CZ, CL) then the segment value may be 
trimmed.  RaSQL will pad the remainder of the segment with spaces if type C, 
or binary zeros if type CL or CZ.  In additio, RaSQL will trim trailing 
spaces from a CZ field.

For example, an index is on the field Company, which is a 30 byte character 
field. The seek value can be from 1 to 30 bytes long. For example,

     N_XSEEK('Communication Horizons')
     N_XSEEK('Communication Horiz')
     N_XSEEK('Comm')

Returns
.T. if an exact match is found, .F. if an exact match is not found.  If 
N_XSOFTSEEK is ON then you will also need to check the setting of N_XEOF().

Remarks
Finds the first (or only) record matching the specified key. N_XSEEK() will 
set N_XFOUND() to .T. if it finds an exact match, .F. if it does not find an 
exact match.

N_XSEEK normally sets N_XEOF() to !N_XFOUND() unless N_XSOFTSEEK is ON.

If N_XSOFTSEEK() is ON, then N_XSEEK() will attempt to find the first record 
equal to or greater than the specified key value.   It returns .T. and sets 
N_XFOUND() to .T. only if it finds an exact match.  It always sets N_XEOF() 
to .F. unless the N_XSEEK positions the record pointer at EOF, i.e., there 
is no key equal to or greater than the specified key value.

You may use this function in the library or in the RDD.  If you use it in 
the RDD, then it will set FOUND() and EOF() as well as N_XFOUND() and 
N_XEOF().

Example
N_XORDER(1)
? N_XINDEXKEY(1)
LAST_NAME, FIRST_NAME
IF .NOT. N_XSEEK('Byrne', 'David')
  ? 'Record not found'
ENDIF


See Also: N_XEOF() N_XFOUND() N_XSEEKEQ() N_XSOFTSEEK()

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