Filter

Filter a list to include only those items that meet a specified condition. (To filter based on more complex criteria, use Filter Custom)

Input Fields

  • list: the list to start with

  • operator: what comparison to make (see table below)

  • path: leave blank when filtering a list of text, numbers, or date/time. When filtering a list of objects, path is the name of the key that holds the value you want to compare. Use a period to specify a path to an object inside another object (e.g. "customer.id").

  • comparison: the value to compare against

IMPORTANT: Be sure to set the type of the input list and comparison to reflect how you would like the comparison to be done. For instance, the operator "greater than" compares numbers based on numeric value but text based on alphabetical sort order. So the number comparison 80 > 9 is true, but the text comparison "80" > "9" is false.

Output Fields

  • list: the new list that contains only those items where the condition was met.

Table of Relational Operators

Operator

Use Case

equal to Compare two texts, numbers, dates or true/false to see if they have the same value
not equal to Compare two texts, numbers, dates or true/false to see if they have different values
greater than or equal Compare two texts, numbers or dates to see if the first has the same or greater value than the second.
less than or equal Compare two texts, numbers or dates to see if the first has the same or lesser value than the second.
greater than Compare two texts, numbers or dates to see if the first has a greater value than the second.
less than Compare two texts, numbers or dates to see if the first has a lesser value than the second.
a multiple of Compare two numbers to see if value a is an exact multiple of value b. (e.g. 12, 0 and -4 are all multiples of 4, but 2, 3 and 7 are not.)
in Compare two texts to see if value a is a part of value b. (e.g. “test” is in “this is a test”, but there is no “i” in “team”)

not in

Compare two texts to see if value a is not part of value b.

has key

When value a is an object and value b is text, tests to see if the object has a key with the specified name. (e.g. true if value a is {“test”:123} and value b is “test”)

doesn't have key

When value a is an object and value b is text, tests to see if the object does not have a key with the specified name.

is empty

Checks to see if value a is empty; ignores value b. What defines “empty” varies by type. Note: Only works for Text and Object. (Numbers, Dates, T/F, are viewed as empty).

is not empty

Checks to see if value a is not empty. Note: Only works for Text and Object. (Numbers, Dates, T/F, are viewed as empty).

Examples

If the input list is [1,2,3,4,5,6] and operator is "greater than", path is left blank, and comparison is 3, then the result is the list of numbers greater than 3, which is [4,5,6].

If the input list is [{"name":"Bob","gender":"male"}, {"name":"Sarah","gender":"female"}] and operator is "equal to", path is "gender", and comparison is "female", then the result is the list of objects where gender is female, which is [{"name":"Sarah","gender":"female"}].

See Also

About lists

Functions

About the elements of Okta Workflows