Warning!
You’re now reading a legacy document. The features described below are only usable within the classic generation environment. Go to this article in order to find out about filtering in the next-gen.
Filters in Betty Blocks are very useful. You can use a filter to get a specific object out of a model or a collection or you can filter your grid so that you can see exactly the objects you want to see. In this article, all the different types of filters and how to use them will be explained.
Condition rows
Every filter is made out of condition rows, with these conditions rows you can set up your filter. A filter can consist of 1 condition row but it is also possible to make a filter with a lot of them. By grouping condition rows together you can make a filter even more efficient.
Row selection: By clicking this checkbox the row will be selected.
Property selection: Here you can select the property you want to apply the filter to. When the property is an object/relation you can also choose which property of the object you want to filter on by clicking on the expand [ ▼ ] button.
Condition selection: Here you can select the condition you want to use on the selected property.
Parameter: Fill in the criteria that the filter has to meet, you can use a number or text depending on the property you are using.
Variable browser: By clicking this button the Variable browser modal will pop up where you can select a variable for your criteria.
Remove variable: When a variable has been selected an eraser icon will appear next to it, by clicking on this the variable will be removed.
Delete: By clicking on the bin icon you will delete that condition row.
AND / OR: When you have multiple condition rows, the AND
and OR
buttons will be visible between the rows. With these buttons, you can set up how the filter combines your condition rows. When the AND
option is selected both condition rows have to be true for the object to appear. When using the OR
option either one of the condition rows has to be true for the object to appear. Changing the option will change it on all rows except when rows are grouped together.
+ Add condition row: By clicking this button a new condition row will appear where you can create another condition for your filter.
Group rows: By clicking this button, all selected rows will be grouped together. This is handy when you are using multiple condition rows and want to use both the AND
and OR
condition. Grouping rows will relocate the group within your filter to the top. This causes all groups to be evaluated first, then the separate rows.
Predicates
A predicate is a statement that will check your property. If a predicate results in true, the filter will show or fetch that property. If the statement is false, the filter will do nothing. Within Betty Blocks there are many different types of predicates that you can use:
Is equal to: Checks if the property is equal to the parameter.
Is not equal to: Checks if the property is not equal to the parameter.
Is lower than: Only usable on numbers or prices, checks if the property is lower than the parameter.
Is lower than or equal to: Only usable on numbers or prices, checks if the property is lower than or equal to the parameter.
Is greater than: Only usable on numbers or prices, checks if the property is greater than the parameter.
Is greater than or equal to: Only usable on numbers or prices, checks if the property is greater than or equal to the parameter.
Is before: Only usable on dates, checks if the property is before the date of the parameter.
Is before or at: Only usable on dates, checks if the property is before or equal to the date of the parameter.
Is after: Only usable on dates, checks if the property is after the date of the parameter.
Is after or at: Only usable on dates, checks if the property is after or equal to the date of the parameter.
Exists: Checks if the property exists.
Does not exist: Checks if the property doesn’t exist.
Is empty: Checks if the property is empty.
Is not empty: Checks if the property isn’t empty.
Contains: Only usable on text, checks if the property contains the parameter.
Does not contain: Only usable on text, checks if a part of the property doesn’t contain the parameter.
Starts with: Only usable on text, checks if the property starts with the parameter.
Ends with: Only usable on text, checks if the property ends with the parameter.
Matches format: Checks if the property matches the value entered as the parameter. Requires a Regex value.
In: Only becomes visible when the parameter is a collection. Checks if the property is included in the parameter collection.
Types of filters
As you're exploring the platform, you'll see filters are used all over the place. The idea of filters is basically the same, wherever you're using them. However, small changes are noticeable and could require some explanation. Let's get into the filters, one by one.
Grid filter
The grid filter is accessible from the grid navigator. Within the grid filter, you can filter your grid on any property you want. You can create a grid filter for yourself or share it with a group within your project.
Filter selection: Select between the filters you have made and the filters that have been shared with you, by clicking on All the grid will be unfiltered.
Edit filter: By clicking this button the filter tab will expand, a form will be visible where you can edit a filter. This button is only visible when currently using a filter.
+ New filter: By clicking this button the filter tab will expand, a form will be visible where you can add a new filter.
Preview: By clicking this button a preview of the outcome for your filter will be created in the grid without saving it. This comes in handy when making adjustments to filters you don't want to mess up.
Delete: By clicking this button, you will remove the filter you are editing. This button is only visible when you are editing a filter.
Display options: With these radio buttons you can select for who the filter that you are creating will be visible. When the For a group option is selected a select list will appear, in here you can choose for which group the filter will be made available.
Filter name: Here you can enter a name for your filter.
Save: By clicking this button you will save the filter you are creating/editing.
Save as: By clicking this button you will save the filter you are editing as a copy. This button is only visible when you are editing an existing filter.
Variable filter
When creating an object or collection variable you will be able to use a filter. You can use this filter to get a specific object or collection that you can then use as a variable. When a filter on an object variable yields multiple records, the first in line is selected for the variable.
Visibility filter
Within forms, you can set the visibility of fieldsets, subviews, and components by creating a filter. You can filter on different types of properties within your project. By choosing record
you will be able to filter with the properties of that record.
Permission filter
It is also possible to use filters to set model permissions. More information about filters in permissions can be found here: What are model permissions? and Permissions in Betty Blocks