6. Defining Frames with Visual Queries : Including Lookup Tables in Visual Queries
 
Share this page                  
Including Lookup Tables in Visual Queries
A visual query can contain no more than one Master table and one Detail table. However, you can designate other tables to use as Lookup tables in your frame definitions.
Use Lookup tables to:
Let the user select an appropriate value for a field
If you include a Lookup table for a field and the user selects the ListChoices operation, Vision displays a selection list containing the valid choices. This allows the user to select an item rather than typing a value.
Validate an entry that the user makes
If you include a Lookup table for a field, Vision validates a user's entry against the Lookup table. The user does not need to use the ListChoices operation.
If the user enters an invalid value, Vision displays an error message that tells the user that the ListChoices operation is available.
Allow Vision to enter values directly into specified fields on the form
In the visual query, you can specify fields on the form--in addition to the field that activates the Lookup table--into which Vision inserts a value. Vision enters the appropriate value when the user chooses an item from the selection list.
If you prohibit the user from entering query restrictions on a Browse or Update frame (as discussed in Qualification Processing), Vision enters data into the form fields without displaying a selection list. Vision displays the form with values already entered, including any values that you specify from the Lookup table.
As an example of a typical use for a Lookup table, assume an order entry clerk uses an Append frame for new orders. The clerk must enter a customer number for each order. The clerk knows a customer's name but not the customer's number. To help the clerk, you can include the Customers table as a Lookup table in the visual query.
When the clerk selects ListChoices on the customer number field, Vision displays a selection list that provides customer names, and even addresses and account balances:
Here is the visual query used to generate the Lookup table:
When the user selects a name from the list, Vision enters the values from the selected item onto the form:
Notice that the field that activates the Lookup table (the customer number) need not be displayed in the selection list.
The previous example is just one way to use a Lookup table in a visual query. For a detailed description of the ways in which users can use Lookup tables and the ListChoices operation, see Using Lookup Tables and the ListChoices Operation.