This guide will show how to search a table using a custom filter in Okta Workflows.
- Okta Workflows
Searching a table
When searching a table, the search is limited to the following conditions:
These conditions are fine when searching with numbers. These conditions do not produce the results needed when searching for text.
For example, if needing to leverage starts with text searching, a different solution is needed. One solution is to use a custom filter. Send all the table rows to a custom filter card and perform the search there. This guide will show how to do that.
The table looks like this. It lists all the world's countries:
This is the main flow:
The flow has the following steps:
- The Helper Flow card has one input (Input) to simplify testing. Click Run and enter a text to search.
- The Tables - Search Rows card does not specify a search condition, so it returns all the rows in a table.
- The List – Filter Custom card calls a helper flow to perform a custom search.
- Country item – is a country name from the list.
- Search for – is the text one is searching for.
- list – is the return value from the Filter Custom card. It is a list holding all the countries that matched the search. Note that its value is a list of text.
This is the helper flow:
The flow has the following steps:
- The Helper Flow card has two inputs:
- Country item – the current country from the list.
- Search for – the text one searches for.
- The Text – Find card finds the first instance of a string within another string.
- The Branching – Assign If card:
- Returns true if position is equal to or greater than 0. This means that the Text – Find card found a match.
- Returns false if position less than 0. This means that the Text – Find card did not find a match.
- The Flow Control – Return card returns either true or false.
How does the List – Filter Custom card work?
The card and its helper flow allow custom search logic to be specified. If the helper flow returns true, the current item will be added to the Filter Custom card’s output list. If the helper flow returns false, the current item will not be added to the output list.
The search logic can be as complex as needed. The helper flow only needs to return a true or a false value.
For example, the current search is case-sensitive. To make it non-case-sensitive, add the Text—To Lower Case card.
Running the flow
Running the flow with the input Be:
The list output field on the List – Filter Custom card holds all the countries that matched in the search.
Showing the list field details:
Related References
