What are filters in data views?
In data views, authors can choose to filter by fields by selecting the relevant fields in Fields or by records in the Filter records (optional section) in the data view editor.
Why is filtering in data views useful?
Filtering allows authors to create bespoke data views for certain users, for example, by filtering only those that are assigned to the logged-in user or records with a certain status.
How to use filters in data views
Filter fields
Authors can choose which fields (columns) are included in the data view and displayed to the relevant data view users. Once a database was selected, the author of the data view can either select all and then deselect all irrelevant columns or only chose the relevant columns when clicking onto the checkbox next to the name.
Name displays the actual title of the case database field and the title of the column in the data view. Names can only be changed in the underlying database.
Reference is the internal variable ID used in the Action builder to pass values from the record into an associated module. For example, these references can be used to pass the name from a record or the ID of the record to a module that contains a URL parameter node to pick up the name or ID.
Filter records
Authors can choose which records are included in the data view, for example, all records with a certain status or containing a certain user name or today's date.
Filter records by field value
If authors want to display only records containing certain values, e.g. only records where the status is set to "Requested" (Status = Requested), they should use the condition builder in the data view editor.
Similar to the condition builder authors are using on transitions in modules, authors can pick the field (column) from the dropdown menu, the operator, and type in the value (case-sensitive!).
For strings (text), email addresses and IDs, authors can use the operators = ...and ≠. For numbers and dates, more operators aside from = , < and > are available as authors can also use ≠, ≤ , ≥.
Filter records by current userÂ
Data views can also be used to show different data to different users, e.g. only show records that “belong” to the current logged-in user. As everyone viewing a data view is either a user, author, or admin, the data view can pick up the email used when logging in. Like this, a data view can be set up once but looks different according to the current logged-in user.
Example:
- All managers use the data view called Pending requests from my team. Each manager only sees requests from “their” employees, because the records filter is set to manager_email is {{current_user_email}}.
- Employees all use the data view “My pending requests”, where employee_email is {{current_user_email}}. With this filter enabled, logged-in employees will only see their own requests in their data view called end-user dashboard.
Filter records by current date
Similar to filtering by current user email, another built-in value, current date, can also be used to filter a data view. When selecting a date value in the condition builder, authors can set a condition to start_date > {{current_date}}. The data view will show only records where the start_date is after today 00:00:00 UTC.
Keywords: dataview; dataviews; Datenansicht; filterrecords; data base; databse; Datenbank