Lookup Table is used for lookup field with Text (Auto-Suggest), Radio, and Select Edit Tags. To enable, check Use lookup table under Edit Tag panel after selecting one of the Edit Tags.
Table name | Required. The lookup table to be linked to. |
Link field | Required. The field to be used as the value of an option. Note that this is the actual value to be submitted by the form This field is usually the key field of the lookup table. |
Display field #1 | Required. The field in lookup table to be used as the label of an option. |
Display field #2 | Optional. The 2nd field in lookup table to be included in the label. |
Display field #3 | Optional. The 3rd field in lookup table to be included in the label. |
Display field #4 | Optional. The 4th field in lookup table to be included in the label. |
Order By | Optional. Specify a field in the lookup table for sorting the options. |
Asc/Desc | Optional. Sorting order. For use with Order By. |
Distinct | Optional. Specify adding DISTINCT option to the SELECT statement for the lookup table. |
Filter |
Optional. Specify the WHERE clause of the SELECT statement for the lookup table. The input should be a valid PHP expression. If it is a string, it should be quoted. If your lookup table has a special field (e.g. named "ALookupTableField") for filtering the records by a field (e.g. named "AField") in the current record (of the current table), you can enter: (strval($this->AField->CurrentValue) != "") ? "`ALookupTableField` = " . $this->AField->CurrentValue : "" Notes
|
Parent field #1 |
Optional. For use with dynamic selection lists. Specify the parent field (in the current table) for the current selection list. When the parent selection list is changed, the available options in current selection list will be changed accordingly. Each field can have up to 4 parent fields. Note Parent field
is solely used with Filter field
for dynamic selection lists only. Each Parent
field MUST have a corresponding Filter
field. The Parent
field alone does NOT do any filtering.
|
Filter field #1 |
Optional. For use with dynamic selection lists. Specify the filter field (in the lookup table) for filtering. When the parent selection list changes, only options (records from the lookup table) with Filter field value matching the selected value(s) of its corresponding Parent field will be shown. Note Filter field
is solely used with Parent field
for dynamic selection lists only. Each Filter
field MUST have a corresponding Parent
field. The Filter
field alone does NOT do any filtering.
|
Parent/Filter #2 |
Optional. For use with dynamic selection lists. The 2nd pair of parent field and filter field. If setup, the filtering of lookup table records will be based on 2 fields. For example, if you have set up Parent/Filter field #1 and Parent/Filter field #2, and both Parent field #1 and Parent field #2 have selected value, the records will be filtered by: (Filter field #1 value = Parent field #1 selected value) AND (Filter field #2 value = Parent field #2 selected value) Note If either
parent field is not selected, above filter will lead
to no results, the field will not have any options.
|
Parent/Filter #3 | Optional. For use with dynamic selection lists. The 3rd pair of parent field and filter field. If setup, the filtering of lookup table records will be based on 3 fields. |
Parent/Filter #4 | Optional. For use with dynamic selection lists. The 4th pair of parent field and filter field. If setup, the filtering of lookup table records will be based on 4 fields. |
Allow add |
Optional. If enabled, the user will be allowed to add an option to the selection list. Limitations
|
Allow sort/search |
Enable sorting and searching of the looked-up values. For use with Select (select-one) or Radio or Text Edit Tag only. Since display values are field values in the lookup table (not in the main table), they are retrieved dynamically by code during execution of the script and normally the field cannot be sorted or searched by the display values. DB AppMaker makes it possible by adding a subquery to the SQL to create a virtual field in the main table. Limitations
|
By default, the options are displayed as comma separated values of the display field values. If you want to display the link field and the display fields in your own HTML, you can use Option Template, just write your HTML code in Option template under Edit Tag panel, e.g. if you have settings like:
and you enter Option Template like:
<ion-text color="primary">{{option.df}}</ion-text> <ion-text color="medium">({{option.df2}})</ion-text>
Then the options for the field will be displayed in your HTML format like:
Option Template supports the following tags:
{{option.lf}} | Link field value |
{{option.df}} | Display field #1 value |
{{option.df2}} | Display field #2 value |
{{option.df3}} | Display field #3 value |
{{option.df4}} | Display field #4 value |
If the options need to show some additional field values from the lookup table, you can set the fields as Display fields (#2 to #4) so you can use them in Option Template.