Form Builder Lookup Element
Table of Contents
- What are Dynamic Attributes?
- What does the Filter Attribute do?
- How do I apply the Filter Attribute?
- What element types support filtering?
- API Filter
What are Dynamic Attributes?
Dynamic Attributes are the successor to those pesky Reference IDs. They will allow users to create new custom settings at the Page and Element level and do it in a much more organized and scalable fashion. As an example, we developed a way to allow the Time or Date-Time element to be shown in either a 12 or 24-hour time format.
Click here for more information.
What does the Filter Attribute do?
When used in tandem with the Lookup element, the Filter attribute restricts the selectable/viewable records based on criteria you determine using filters such as equal to, like, greater than, less than, etc.
PLEASE NOTE: This Dynamic Element Attribute is available with iForm for iOS 8.36 and iForm for Android 8.12.
How do I apply the Filter Attribute?
To apply the Filter Attribute to the Lookup element, follow the instructions below.
PLEASE NOTE : Make sure you have "Download Records" turned on in the app settings to be able to download the lookup records.
STEP 1. With your form loaded in the Form Builder, highlight the Lookup element where you'll be applying the filter.
STEP 2. Under the Element Properties section, click the Dynamic Attributes drop-down.
STEP 3. Select Filter from the drop-down choices.
STEP 4. From the Field Name drop-down menu, select the field you'll use to filter by.
STEP 5. From the Condition drop-down menu, select the condition under which the filter is applied.
PLEASE NOTE : When using the LIKE Condition wildcard characters (%) are automatically added around the 'Field Value'
STEP 6. You'll now add the value you want the field to match. You have four options to choose from.
- String: This is used for text-based fields. Be sure to put quotes around your value in this instance. (PLEASE NOTE: if the Field Name element type is an option based element, you will need to set the Condition to a Field Value that is the Key Value in the option list with double quotes).
- Number: This is used for number-based fields.
- Data Column Name: Used if you are comparing it to values in another element on the form.
- iFormBuilder Function: Used if you are comparing it to another element on the form that uses one of our Built-In Functions.
You can multiple filters to a Lookup element by clicking +Group and adding the filters.
STEP 7. Once your filter(s) is in place, click Confirm.
Once you've confirmed, you can see your filter in two different formats.
SQL Query
JS Statement
STEP 8. Save your form.
STEP 9. Test the filter on your device.
Here is what the data table looks like before the filter is added in the form builder:
And here is what it looks like with the filter added. Notice only the record with Joe as the employee name is shown.
To create filters using the API, have a look at the documentation HERE.
What element types support filtering in the Lookup element?
The below elements support the Filter Attribute when using in conjunction with the Lookup element.
API FILTER
Description: Restrict the selectable records based on criteria
API Information
Attribute Label | Attribute Name | Attribute Type | Accepted Values |
Filter | lookup_filter | filter | See Below |
The filter's value will consist of a JSON array with field_name, condition and field_value. A simple example of a filter looks like this.
{
"attribute_name": "lookup_filter",
"value": [
"AND",
{
"field_name": "bag_size",
"condition": "not like",
"field_value": "small"
},
[
"OR",
{
"field_name": "zipper_count",
"condition": ">",
"field_value": "145"
},
{
"field_name": "receipt_count",
"condition": "is not null",
"field_value": ""
}
]
]
}
In SQL, this would look like:
(bag_size Not Like small) AND ((zipper_count= 145) OR(select_widget is not
Null))
Below symbols that can be used in the condition object.
Condition | Symbol |
Equal to | "==" |
Not Equal to |
"!=" |
Greater than | ">" |
Less Than | "<" |
Greater than or equal to |
">=" |
Less than or equal to | "<=" |
Like | "like" |
Not Like | "not like" |
Is NULL | "is null" |
Is not NULL | "is not null" |
Comments
0 comments
Please sign in to leave a comment.