Find the first item in a list that meets a specified condition. (To find based on more complex criteria, use Find Custom)

Input Fields

  • list (list of objects): the list to start with
  • operator (drop down menu): what comparison to make (see table below)
  • path (text): leave blank when searching within a list of text, numbers, or date/time. When searching within 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.

Use Find Custom if you require more options to determine if the item is a match. Use Filter or Filter Custom to find all of the elements in a list the match a criteria.

Output Fields

  • item (object): the first item in the list that meets the specified criteria.
  • index (number): the location of the found item in the original list, where 0 is the first item in the list. Returns -1 if there is no match.

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 items in the list are an exact multiple of the comparison. (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 items in the list are part of the comparison. (e.g. “test” is in “this is a test”, but there is no “i” in “team”)
not in Compare two texts to see if items in the list are not part of the comparison.
has key When an item in the list is an object and the comparison is text, tests to see if the object has a key with the specified name. (e.g. true if item on the list is {“order_num”:123} and comparison is “order_num”). Path only required when searching for a nested key.
doesn’t have key When an item in the list is an object and the comparison is text, tests to see if the object does not have a key with the specified name. (e.g. true if item on the list is {“order_num”:123} and comparison is “name”). Path only required when searching for a nested key.
is empty Checks to see if an item on the list is empty; ignores the comparison. 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 item on a list 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,22,30,4,35,46] and operator is “greater than”, path is left blank, and comparison is 30, then the result item is 35 (the first number in the list greater than 30) and index is 4.

If the input list is [{"name":"Bob","department":"Sales"}, {"name":"Sarah","department":"Engineering"}] and operator is “equal to”, path is “department”, and comparison is “Engineering”, then the result item is {"name":"Sarah","department":"Engineering"} and index 1, the first object in the list, in index position 1, where department is “Engineering”. If you ran the same check but with comparison “Marketing” then the result item would be {} and index -1 since no objects match.