Find()
Finds/positions records.
Syntax
Find(<xData>, <ncOrder>, <lNotExact>)
Arguments
<xData> --> the data to find.
<ncOrder> --> the optional sort order as a number or the order as a character string representing the name of the sort order. For card file databases the name of the order is the same as the name of the field being sorted.
The first sort order (the key) of the form's main table is used if the sort order is not specified.
<lNotExact> --> If not specified, CAPITAL performs an exact match. If TRUE is specified CAPITAL will match the next closest value if it exits.
Returns
Returns logical TRUE if the record was found, otherwise logical FALSE.
Description
Find() locates the first record whose key value matches <xData>. If the record is found the function returns logical TRUE. Otherwise logical FALSE is returned. The form must be sorted or the database being searched must have index files associated with it.
<ncOrder> refers to the sort order. It defaults to 1 (the first sort order or main key) if not specified. If a database has more than one pre-defined sort order, then specify 2 for the 2nd sort order, 3 for the third and so on. To view the list of available sort orders under Visual Builder, go to the Links tab and click on the Sort list.
If you know the name of the sort order you can specify the name instead as a character string. For card file databases the name of the sort order always matches the name of the field being sorted, so if you are sorting on a field called DATE, then the sort order will also be called DATE.
<lNotExact> defaults to FALSE. CAPITAL will try to match the entry exactly if FALSE is passed. If TRUE is passed and there is no exact match in the system, the next closest match in alphabetical order is located unless the end of the file is encountered first.
Examples
* Locate the contents of cName
Find(cName)
* Locate the contents of cName but search on the second order.
Find(cName, 2)
* Locate the closest match to cName if there is no exact match
Find(cName,, TRUE)
* Locate the date dMyDate and search on the Date sort order.
Find(dMyDate, "Date")
____________________________
Related Topics: