Below are the different methods of filtering within Budibase.
Once you have linked a Datasource to a component, you can access the filter drawer by clicking the button beside the Filtering setting in the Settings Panel.
The filter drawer is where you select the columns you want to filter on. For example, you may want to return sales records for the region of Europe, where the unit price is within a range.
As shown above, you can filter on multiple columns, and even filter on the same column multiple times.
Often you will find yourself wanting to let the user filter the data on the front-end. This can be achieved as well but requires a bit more work. To get started you will need a Form component. Select the schema you want, most often it will be the same thing you select in the data provider. Inside the form, put a Data Provider component as well as a field of your choice, an easy one to get started with is the Number Field. On the field component you select the column you want to filter on. In the example below we'll use the unit price.
In the data provider, select the define filters button. Next, add an expression and select the same
Unit Price that you selected for the number field component,
More than and
Binding. Select the lightning bolt icon to the right and select the number field from the list of bindings that comes up. After saving your users should now be able to filter the data themselves.
When filtering, there are a couple of settings that can be tweaked that determine how the filters are handled.
- Match all filters: the default; all filters must match when returning records
- Match any filter: records are returned when they match on any of the provided filters
This setting is specific to filters that are using Bindings. It determines what data should be returned if the binding values are blank.
By default, if all of the filter binding values are empty, then all the rows will be returned. If Return no rows is selected and the binding values are empty, then no rows will be returned.
As shown above, the filters are bound to two form fields which are currently empty, therefore all table rows are returned.
In this screenshot we can see that the Return no rows option is selected, which prevents rows being displayed as the bound form values are empty.
You can also filter using a relationship picker.
Updated 3 months ago