Filtering allows you to query specific data values based on a condition(s) you set while building the form. This method is useful if you want to retrieve a portion of the data and avoid slower querying time periods.
Filtering can be optionally applied to a SharePoint list or library.
HOW TO SET A FILTER
Step 1: Before you can filter the data, you need to set up the connection with the data source. Please refer to the below articles to see how you can set up a SharePoint Query from list or a library:
- How to query from a SharePoint list
- How to query from a SharePoint library
For the purpose of this article, I have already set up a data connector to a SharePoint list called 'Equipment_list'. Please see a sample of the list below.
Note: My objective is to retrieve equipments in this list that are tools only.
Step 2: Once you set up the connector, your data source will be visible under the Query tab on the right side on the screen. At the bottom of your data connector tile you will see some actions that allow you to filter, edit or delete the data connector.
To set the filtering, please click filter.
Step 3: After clicking filter, the below window will be displayed on your screen. You can set a rule that filters data depending on a specific value.
- The first dropdown allows you to select a field from the data source
- The second dropdown allows you to select a condition
- The third dropdown allows you to select a value or a field that you want to compare the data to (Field will be implemented in later releases)
- Order by allows you to order the retrieved data by column
To retrieve all the data that meets the condition we want, we have to set a filtering rule that queries equipments that are tools only. (Equipment Type =Tools)
Once you set the rule, click SAVE at the bottom of the window.
TESTING THE FILTER ON A CONTROL
Step 4: The filtering has already been set, now we have to check if it works.
To do that, we will have to add a dropwdown control that populates data from a data source.
Start by adding the dropdown by clicking on it from the controls panel.
Step 5: Once you add the dropdown and select it, the properties panel will be visible on the left side of the screen. Under the Items section please select Data source from the dropdown. This will allow you to populate the list of items from the data connector(s) you added to the form. Click EDIT DATA SOURCE.
Step 6: In the data source window, please select the Data source you want to query data from. In my case I am going to select the SharePoint list I added earlier: 'Equipment_list'. In the Value & Display Name dropdowns, I am going to select Equipment Description because that is the title of the column that contains the list of items I want to show in my dropdown.
Note: Value refers to the value of the field and Display Name refers to the name displayed in the form, most of the time they are the same.
Click SAVE and close the window.
Now click SAVE & PUBLISH at the top left of your screen to save the form and test it.
Step 7: Once the form is installed on the device, the dropdown should populate the data under the 'Equipment Description' column that have Equipment Type =Tools.