Specify Filters for Controls

You can specify filters for controls that accept list of values (LOV) as input, such as drop-down select, checklist, checkbox, and radio button controls. You can use a filter to selectively extract data from a data source (such as payload or an external connector) and display the filtered data as options of the control.

To specify a filter for an LOV control (for example, drop-down select):

  1. Click on the control in the form’s canvas, and in the Properties pane's General tab, navigate to the Option Source section.

  2. Select the data source as either From Data or Connector. Configure subsequent fields to match your selection.

  3. A Filter check box appears after you complete configuring the Option Source section.

  4. Select the check box, and click the Edit button that appears next to it.

  5. In the Filter window, specify how the data is to be filtered from the source. You can also use an If block to specify the same.

    Note:

    If you specify more than one way to filter data from the source, the results are ORed.
  6. Click OK, then Save.

Filtering in Controls – An Example

This section demonstrates filtering in controls using a web form with a drop-down select control.

Based on the filtering condition specified for the control, you will be able to see relevant data as options of the control when the form loads.

In this example, we use a previously created REST connector to fetch data from a web server, which contains a list of items. Each item, in this case, is a complex data object that contains details of employees of an organization, such as first name, last name, unique ID, phone number, isActive (this Boolean attribute specifies if the individual is a current employee or not), city, and so on. To create a REST connector from scratch, see Creating a REST Connector.

We use this REST connector as the input to the select control.

Now, let’s configure the select control to suit this example.
  1. Click on the control, and on the General tab, change the Label field to First Name.

  2. Under Options Source, select the Connector option and populate the Resource and Operation fields with respect to the REST connector defined within the application. See Populating Controls Using REST Calls.

  3. Under Response, specify the items list to display as options of the control.
    1. For this particular example, we map the first name attribute to the Label Binding field, so that only first names of employees appear as options in the select control. Also, the unique ID attribute is mapped to the Value Binding field as follows:
      Description of filter-response.png follows
      Description of the illustration filter-response.png

  4. Select the Filter check box, and click the Edit button that appears next to it.

  5. In the Filter window, specify a condition to filter specific data from the source. The filter configuration in the following figure extracts only active items (that is, current employees of the organization) from the data source to display as options of the select control:
    Description of filter-active1.png follows
    Description of the illustration filter-active1.png

  6. When the form loads, the control displays first names of all current employees as follows:
    Description of filter-list1.png follows
    Description of the illustration filter-list1.png

  7. You can change the filter configuration on the select control to display only former employees (isActive=false) as follows:Description of filter_active2.png follows
    Description of the illustration filter_active2.png

  8. The options in the drop-down select change accordingly:
    Description of filter-list2.png follows
    Description of the illustration filter-list2.png