Search the database without using an SQL statement, where the search is based on key
field(s) using the LOCATE command. It fetches all fields of records that match the search
criteria.
Before you begin: Ensure that you define the Database Read data source that is
used in the LOCATE command.The LOCATE command is
applicable for all data sources of the Read type, where a key field is defined.
For example, the BookMaster database contains the
details of all books available in the library. You can use the LOCATE command to locate
the Title and Author of all books with Scode=E001. The BookMaster database contains the
following fields: Book_Num, Title, Author, Scode, Pcode, Edition_Num, and Issued as
shown in the image below:
The image below shows the LOCATE Command
Editor used to specify the search to find the Title and Author of all records that match
the subject code E001. The Record Assignment section displays all the fields with a
corresponding Variable text box. You can type or drag and drop variables to the text
box. The LOCATE rule assigns the located field values to the selected variables.
Under the Rule
tab, from the COMMANDS drop-down, drag and drop the LOCATE command to the
Working Canvas.
Optionally, in the
Comment text box, enter any descriptive comments you want to include for
the rule procedure you are defining.
In the Data Source
drop-down, select the required database.
In the Key Look up
Fields section, the fields that you assigned as key fields while defining the
data source are displayed.
In the Record
Assignment section, in the Variables drop-down select the variables
that you have declared to store the retrieved values based on the criteria specified
in the LOCATE rule. For example, to print the Title and Author based on the Subject
Code (Scode).
Note: If there are multiple values to be fetched for a single condition, you should
select an array variable. Other variables fetch only the last record that matches
the specified criteria.