- App Settings
Filters are a powerful way to display rows in a sheet that satisfy a condition (searching) . In XLapp the content you would like to search or filter should be laid out as a table with the data in rows and columns.
In this tutorial we will use a sample table with Name of States, Cities in the State and min temperature in that city.
You can download the xlsx file from here.
The first step is to select the data in the columns and name them.
In our sample we will name the first column as “state”
In our sample we will name the Second column as “city”
and the Third column as “temp” for Temperature.
Now that we have setup our data set, we will create the form that the user will use to filter the data.
For this we need to define a cell that will allow the user to enter or select a value which will be used to filter the data.
For the state filter we will use a dropdown.
To filter the state we need to name the cell as “state.list.filter”
Where “state” indicates that this cell value will be used to filter the state data (we had named that earlier).
List indicates that we are planning to use a dropdown list for the user to select the state he wants.
filter is the special attribute that indicates to XLApp that this cell will be used for filtering data.
Next we setup the list by setting the Data→Validation and set the validation to list and enter the following values “*,Andhra Pradesh,Arunachal Pradesh,Chhattisgarh”.
Then we select “*” as the default option in the list. Note this list can come from a range of cells too.
This indicates that by default all the items will be listed when the user hits go in the mobile app.
Now we upload the XLSX file to the server and map the “Select State” and the Filter cell to input and map the all data to the output.
Next we map the data cells to the output
Now When we preview the app we can see the Filter Dropdown.
When the user selects a value and hits Result we can see the filters being applied and the filtered data in the output.
Next lets add a filter for City. Here we will use a text box where the user can enter a few characters and search.
We make the type of the cell to Text.
After we upload the app we add the City filter to the input , we preview the app.
Next We can use a range slider widget to filter the temperature.
In some cases you might want the user to select from a list of items for filtering for this we use the checklist widget.