Filtering in Adalo
Filtering is a powerful feature that allows you to refine and organize data within your app. Whether you're a seasoned app builder or just getting started, understanding filtering concepts will help you tailor your app to meet your specific needs.
Key Filtering Concepts:
Filter Criteria: This refers to the rules you set to determine which data should be displayed or hidden. For example, you might want to only display orders placed in the last 30 days or show tasks assigned to a specific team member using a Relationship Property.
Filter Fields: These are the Properties in your Collections of data that you can use to filter. For instance, if you're managing a list of products, your filter fields could include product name, price, or category.
Filter Operators: Operators are used to define the relationship between the filter criteria and the data. Adalo supports various operators such as equals, not equals, contains, greater than, less than, and many more depending on the Property Type. These operators help you specify how you want to filter your data.
Logical Operators: Logical operators are used to combine multiple filter criteria to create complex filtering conditions. Adalo supports AND and OR operators in Lists. They allow you to refine your filters further by specifying conditions that must be met simultaneously or independently.
Where to Find Filters
Filters are typically found in List components and components that display whole groups of records such as:
Lists
Counts
Dropdown Component
Deck Swiper
Image Swiper
Calendar
Chart Kits
...and many more!
Filters
Filters can be found in most commonly in Lists that show groups of data from your Collections. In the example below, we have a List of Trips and the default filter is set to All Trips. You can filter further based on the Available Screen Data or Logged in User data by selecting the dropdown.
Custom Filters
Custom Filter can be added anywhere you see the +Add Custom Filter button. These are used to combine logic and display very specific groups of records using Filter Operators. In the same example as above, we want to only display the Trips where the Travelers (Relationship to Users) contains the Logged in User.
Filter Operators:
Filter Operators are how Adalo determines what records to show. They result in either being true or false. Based on this information, either Adalo should (true) show records based on this operator or it should not (false). Both filters and conditions use operators to determine what do to with records, components, or actions.
Following the if-then logic mentioned earlier we can use logical operators within filters and conditions to instruct Adalo that "if this thing is true, then do this other thing".
Operator Types
Operators:
Is equal to - This operator is case sensitive and the two pieces of text must match each other exactly - even if there is a hidden return or space in the text. This operator is very strict.
"Day" is equal to "day" = false "Day" is equal to "Day" = true
Is not equal to - This operator is also case sensitive and determines if the two pieces of text are different from one another - even by a space or return. This operator is very strict. Hint: it's often easier to exclude items that to determine if they match exactly.
"Day" is not equal to "day" = true
"Day" is not equal to "Day" = false
Contains - This operator determine if a string of text contains another string of text. This operator is not very strict and not case sensitive, but can sometimes have unintended consequences if multiple records share the same text string. For example, test@gmail.com and gmail@test.com both contain "gmail" but they are not the same result. This also makes it great for searching for records in your app.
"Day" contains "day" = true "Day" contains "Day"= true
"Tuesday" contains "Day" = true
Logical Operators
Within filters you have the option to make custom filters be inclusive of each other, or exclusive of each other. For Lists that have multiple custom filters, you can choose whether all of those filters must be true in order to show records, or you can choose whether any of the filters are true.
If you want to display data only when all criteria are met, you can click on the + AND button. In the example below, we only want to display the Trips where the Travelers (Relationship to Users) contains the Logged in User , AND have a Travel Date is after the Date the Logged in User is viewing the List.
If you want to display data only when any criteria are met, you can click on the +Add Custom Filter button. In the example below, we only want to display the Trips where the Travelers (Relationship to Users) contains the Logged in User , OR the Trip Status is equal to Active
0 vs. Null (Empty):
In data management, 0 and Null represent different states. 0 is a valid numerical value, indicating the absence of a quantity or a specific value. Null signifies the absence of any value or unknown value indicating that no data is present in a particular field. In Adalo, Null is referred to as Empty.
Filtering Empty Values:
Empty cannot be used to evaluate whether a Relationship exists AND the operator is Empty.
Example: You only want records where a relationship exists, but a certain property is empty.
Empty cannot be used to filter a count of records.
Example: You only want records that do not have a relationship count. Since Counts are Numbers, you must compare to a Number such as '0'
Advanced Filtering Techniques:
Checking Relationships: You can check if a record has a relationship across a many-to-one relationship by examining the Relationship’s ID property for Empty.
Example: You can get a list of Leads that do not have a Sales Person [many Leads, one Sales Person], by checking Current Leads > Sales Person > ID is equal to Empty.
Evaluating Image and File Properties: You can evaluate if a record does or does not have an image or file saved for an Image or File property.
Example: You can only show options in a Dropdown component that have a saved Contract [File property], by applying a custom filter to only show records where Contract > URL is not equal to Empty.
Evaluating Location Properties: Similarly, you can evaluate if a record does or does not have a location saved for a Location property.
Example: You can get a count of all Restaurants that do not have a Location, by using a Magic Text Count of all Restaurants with a custom filter set to Restaurant's > Location > Full Address is equal to Empty.
Please Note: Adding too many filters to any Component can negatively impact performance of the app for the end user.
Learn More
You can combine filters with conditions to give even more control over what happens in your app. For instance, you may change the visibility of a component based on a filtered count of a collection of records in your database.
Currently conditional actions and conditional visibility can only have one filter attached to them, but filters for lists, counts, charts, and other components can have multiple filters.
Help
If you need additional help with this article, you can always ask in our community forum! Be sure to paste the link to this article in your post as well!
Do you have a tutorial or help doc request? Let us know!
Last updated