Define a Table Query
Description
When building components in the Grid Builder it is often necessary to pull specific data and records from a given table, be it .dbf or SQL. To do this it is necessary to create a Table Query.
Step 1. To Start With:
Select Grid > Query (DBF).
Select the data source table from the Table Name list.
Step 2. Creating Table Aliases
A table alias can make your grid portable, by separating it from direct reference to a table name. as long as a table has the same structure and the same alias, it can use a grid originally built for another table.
Optionally, enter an alias for the table. If you do not enter an alias, it will default to the name of the table.
Step 3. Creating Calculated Fields
A calculated value may be displayed, but not edited. Typically, you compute a calculated value based on the values of several other fields in each record. To create a calculated value to place on the grid:
Optionally, click Calculated fieldsto display the Define Calculated Fields dialog box.
a. Enter calculated value expressions, one per line, in the format = . For example:
<fullname> = <alltrim(lastname) + ", " + alltrim(firstname)>
b. Optionally, click Expression Builder to use the Expression Builder to help you define the calculated value.
c. Optionally, click F2 - Fieldsto display a list of table fields to insert into the expression.
d. Optionally, click F4 - Functionsto display a list of functions to insert into the expression.
e. Optionally, use the and buttons to sort the list of calculated values.
f. Optionally, use the , , and buttons to reorganize the sequence of calculated values.
g. Click OKto continue or Cancelto discard your inputs.
Step 4. Define Arguments
Optionally, if you want to provide a value for use in the grid's filter expression, click Define Argumentsto display the Define Arguments dialog box.
Step 5. Enter a Filter Expression
Optionally, enter a logical expression that selects records from the table into the Filter field. You may click to use the Expression Builder to help you define the expression. A blank filter expression retrieves all records in the table.
Optionally, check Unique records onlyto eliminate records with duplicate values.
Step 6. Enter an Order Expression
Optionally, enter a character expression that orders selected records into the Order field. You may click to use the Order Builder to help you define the expression. A blank order expression retrieves records in record number order.
Optionally, click Ascendingor Descendingto change the sequence of records.
Step 7. Enable Editing of Records
Optionally, check Read onlyto indicate that you do not need to define a primary key.
Click Define Primary Key(s)to define the field or character expression that will uniquely identify records.
See Also