Find

Command group Flag affected Reversible Execute on client Platform(s)
Finding data YES YES NO All

Syntax

Find on field-name ([Exact match][,Use search]) {calculation}

Options

Exact match If specified, the index value of the field in suitable records must equal the current value
Use search If specified, the command uses the current search to select data

Description

This command builds a find table and locates the first record in the table, that is, it loads the main and connected files into the current record buffer. The flag is false and the buffer is cleared if no record is found.

You use the Find command to locate records within a file. If you don’t use a search, the file is searched in the order specified by the indexed field until the value given in the calculation line is matched. In this case, the current find table is the same as the chosen Index.

When the closest match is found, the main and connected files are read into the current record buffer and the flag is set true. If the indexed field is from a connected file, the search is repeated automatically until the record having a connected entry in the main file is found.

A blank calculation indicates that the Find is to be performed using the current value of the selected index field. Thus, if you precede the command with a Clear main file, it is the same as a Find first.

Omnis can perform a Find with an Exact match requirement. In this case, the value in the "field found" record must correspond in every detail (for example, upper or lower case characters) to the current value of the indexed field in the current record buffer. A flag true indicates a successful Find, otherwise a flag false results, and the main and its connected files are cleared.

You use the exact match option to locate child records connected to a current parent record.

Clearing the find table

The find table is cleared if:

  1. Clear find table command is executed with the same main file setting.

  2. A new Find is carried out on the same file.

  3. Next/Previous command with a new (non-blank) index or a Use Search or Exact match option where the original Find had none, is used.

Example

; Find all invoices belonging to account lMyAccCode
Prompt for input Account Code ? Returns lMyAccCode (Cancel button)
If flag true
  Set main file {fInvoices}
  Set search as calculation {fInvoices.AccCode=lMyAccCode}
  Find on fInvoices.InvNum (Exact match,Use search)
  While flag true
    OK message {Found Invoice [fInvoices.InvNum] for account [fInvoices.AccCode]}
    Next
  End While
End If