Field Filtering
You can now filter selection fields. In the underlying datastore, you can use any field to filter against.
As an example, build a datastore called 'Filtering Examples', and a vield 'Value' and a second field called 'Filter'. We will share some examples as how to filter.
Add some cities as values, and their country in the Filter field:
Bruges - Belgium
Brussels - Belgium
Ghent - Belgium
Amsterdam - The Netherlands
Rotterdam - The Netherlands
Frankfurt - Germany
Dresden - Germany
When entering a filter, select as type 'Plain text'. NCALC and Javascript will only be used in exceptional cases, you can already do a lot with the plain text filters.
To only show the cities from Belgium, use this filter:
[{ "fieldname": 'Filter', "filtervalue": 'Belgium' }]
To show the cities form both Germany & Belgium, use this filter:
[{ "fieldname": 'Filter', "filtervalue": 'Belgium' },{"connector": 'or', "fieldname": 'Filter', "filtervalue": 'Germany' }]
Create a text field, called 'Country'. If you want to filter against that text field:
[{ "fieldname": 'Filter', "filtervalue": #REPLACE-PARTVALUE-Country||# }]
Final note: Filters are applied to existing services, so a task runs every 5 minutes to apply any changes. You can kickstart this task by opening this link:
Best Practise with versions
When a template is exported from one installation and then imported in another, you might want to use different values in a select field. To avoid making a new datastore parameter to support this, you can also use filtering. This is how to set it up, do this from the start, to avoid issues when migrating:
Any datastore parameter that is used in a selection field, please add a field 'filter_version'
Enter '001' as version for all entries
When this datastore parameter is used, set up this 'Plain text' Filter:
[{ "fieldname": 'filter_versie', "filteroperator": 'contains', "filtervalue": '001' }]
Now, when you want to change the list of values, but not impact the current & old requests, follow these steps:
Add '002' in the field 'filter_version'. Do not delete '001' anywhere, as this will affect the older requests.
Open the field in the template-editor, and change the Filter to:
[{ "fieldname": 'filter_versie', "filteroperator": 'contains', "filtervalue": '002' }]
With this solution, you can freely choose which fields need a new set of values.
It is important to do this from setup, because adding it in later requires database-handling from our support team.
Last updated