This article describes how to filter a list with the List Filter card.
- Okta Workflows
The Okta – List Filter card allows filtering a list to include only those items that meet a specified condition.
- In this example, there is a list of numbers, and it is desired to filter only the numbers bigger than 300:
- The List Card card creates a number list.
- Using the List Filter card, filter or return only values that meet a certain condition. In this example, the operator field is set to greater than or equal to 300. The comparison value is 300. Look for numbers bigger than or equal to 300.
- The path is empty in this example. The path will be used in the next example.
- The next examples use this list of objects:
[ { "name": "James", "department": "HR", "employees": 10, "location": { "geo": "North America" } }, { "name": "Ali", "department": "Operations", "employees": 20, "location": { "geo": "North America" } }, { "name": "Jane", "department": "Engineering", "employees": 20, "location": { "geo": "South America" } }]
The List Construct card creates the list. The List Filter card specifies the path field, as this list has objects. The path field indicates where to search for the condition.
In this example, search for a department set to Operations:
Running this flow returns one object where the department is set to Operations:
- In the next example, set the path to employees, and filter by all departments that have ten or more employees:
There are two items (objects) with ten or more employees:
Expanding the result:
- In the next example, filter by location.geo path:
Result running this flow:
