Configuring the Binding
After selecting a table in the Browse Database tree, you can customize which columns the query is selecting by selecting one or more columns under the table to select just the highlighted columns, or selecting the table to use the * symbol to select all columns.
The DB Browse binding has the ability to designate key columns within the query. A key column is used within the select query's where clause, and can be given a value. A column is denoted as a key column when it has a key symbol next to it.
Clicking the Key icon to the right of the Browse Database tree will designate a column as a key column. Alternately, if the highlighted column is already a key column, then clicking the Key icon will remove that column as a key column.
In the DB Browse binding, you can also sort data in ascending or descending order. Select the column that you want to sort by and click the Sorticon. Multiple columns can be used for sorting.
- In the Designer, drag a Table component and a Text Field component on a window.
- With the Table component selected, click the Binding icon next to the Data property.
- Chose DB Browse under Binding Types > Database.
- Let's pull all the data from this Table except for the id, and filter on state. Remove the Key from the id column and place it on the state column.
- Select the Tank_Number, Lot_ID, Notes, and t_stamp columns. You can do this with Control+Click, or by clicking and dragging in the results table in the upper right.
- Instead of statically typing in a value like we in did in the above example, let's make it dynamic using the Text Field. Click the Insert Property Value icon next to the value in the Key Columns section, and select the Text property of the Text Field.
- Notice there is now a property reference in the Key Column as well as the Generated SELECT Query.
- Click OK to confirm the binding
- Put the Designer into Preview mode.
- Enter the Lot_ID that you want to view. You'll see the Table update to display just the data for that Lot ID.