Workbench User Guide : Generating Frames from Predefined Templates : The mastdetl Templates : The simple_field Template
 
Share this page          
The simple_field Template
The simple_field frame template creates a standard database table browser. The generated frame consists of a matrix of entry fields, which are automatically loaded with the results of a single query against one or more joined tables. Each field maps by name and type to one of the result columns of the query. The frame can display only one row returned by the query at a time.
Note:  Frames generated from this template cannot call frames generated from the detail or explosion frame templates. In contrast, a similar type of frame—a table field frame—can call detail or explosion frames. For more information, see The table_field Template.
Create a Simple Field Frame
You can create a simple field frame using the simple_field template.
To create a frame using the simple_field template
1. On the Develop tab, select the application in which you want to create the frame in the Applications portlet, and then select the header bar of the Components portlet to make it active.
2. Click File, New, User Frame.
The Create User Frame dialog appears.
3. Enter the component name in the Name field (for example, My_Simple_Field).
4. (Optional) Enter a comment for the component in the Remark field.
5. Select mastdetl from the Application list and the simple_field template from the Template list.
6. Click Create.
The Select Database Object dialog appears.
7. Enter the name of the primary table in the Table field.
For more information about using the control button to the right of the entry field to specify a table, see Table Selection Dialog.
8. Click OK.
The Frame Assistant appears.
9. Using the Frame Assistant, you can optionally specify additional tables, including lookup or associate tables. You can also select query expressions, query properties, and display properties for result columns.
For more information, see:
How You Can Set Query Expressions)
How You Can Set Query Properties)
How You Can Set Display Properties)
Add Additional Tables to a Generated Frame)
10. Click Generate.
The frame is created and displayed in the Frame Editor.
11. (Optional) Specify the frame's properties using the Property Inspector.
For more information about using the Property Inspector, see Set Frame Properties.
How You Can Use a Simple Field Frame
The generated simple field frame provides a set of VCR buttons and a slider to navigate through each selected row, with its values updated automatically in a matrix of fields.
To see the simple field frame in operation, click Debug, Go on the floating menu bar.
The frame's Form menu provides commands to perform standard database row operations such as inserting a new row, duplicating the current row, deleting a row, and saving changes to the table. The Sort command lets you choose the order that the data rows appear in the frame. For more information, see How You Can Sort Data in a Frame.
You can also perform queries based on the data you enter into one or more fields by clicking Form, Query. For more information, see How You Can Perform a Query.
Note:  Use the standard Close button in the upper right corner to close a running frame and return to the Frame Editor.
How You Can Sort Data in a Frame
By default, the sort order of the data that appears in the frame is based on the order of the columns in the table. In addition, each column returns data in ascending order. This sort order can be changed by clicking Form, Sort. The Set Data Sort Order dialog appears.
To change the sort order by columns, click a column in the Columns list field and click the right arrow. It then appears in the Order By Columns list field. Subsequent column choices appear in this list in the order they are chosen. Similarly, a column choice can be removed from the Order by Columns list by selecting it and clicking the left arrow button.
To change the sort order further, from within the Order by Columns list, click the column name and then click the up or down arrow. You can set whether the data for a column is sorted in ascending or descending order. By default, data is sorted in ascending order (that is, Asc is selected). To change the sort order for a column to descending order, select the Desc option from the option field.
When you click OK, the selected sort order takes effect, a new query is performed, and the data values are populated into the fields of the frame.
How You Can Perform a Query
When the Query is selected from the Form menu of a simple field frame, the Query dialog appears. On this dialog, you can perform queries based on data entered into one or more entry fields.
The following features are available:
Reading a Query
To read a saved query, click File, Read from File. This displays a standard File Selection dialog from which you can select a file.
Defining a Query
You enter data into the desired fields to define your query. Click Query, Clear to clear all fields on the form.
You can save the current query to a file by clicking File, Write to File. This also displays a standard File Selection dialog, allowing you to select the name and location of the file.
Running a Query
To perform the query, click Run (or click Query, Run).
Accessing Previous Queries
To navigate through previously run queries, click Query, Previous and Query, Next. As you step through each query, the matrix of fields is populated with the associated query data.
Viewing the SQL Commands
You can view the SQL statements and commands that will be executed when the current query is run, by clicking Query, View SQL.
Sorting Query Data
By clicking Query, Sort, you can select the sort order of the rows that are returned from the query. (This is the same sort order used for the simple field frame, accessed by clicking Form, Sort.)
For more information, see How You Can Sort Data in a Frame.