Ask AI
Skip to main content

Find first match by formula

Function: Find first match by formula

This action helps you quickly locate the very first item within a list that satisfies a specific rule or condition you define. It's like scanning a list of things and picking out the first one that fits your criteria.

Input

  • List: This is the collection of items (like numbers, text, or even more complex records) that you want to search through. This input is required.
  • Condition: This is the rule or formula that each item in your list will be checked against. For example, you might set a condition like "item is greater than 10" or "item contains the word 'urgent'". This input is required.
  • List Object Attribute: If your list contains complex items (like a list of customer records, where each record has a name, age, and city), you can use this input to specify which part of each item you want to check against your condition. For instance, you might specify "age" if you want to find a customer based on their age. This input is optional.

Output

  • Result: This will be the first item from your list that successfully meets the condition you provided. If no item in the list matches your condition, this output will be empty. The output will be a text representation of the found item.

Execution Flow

Real-Life Examples

Here are some practical ways you can use the "Find first match by formula" action:

Example 1: Finding the first product above a certain price

Imagine you have a list of product prices and you want to quickly find the first product that costs more than $50.

  • Inputs:
    • List: [25.00, 60.50, 40.00, 75.25]
    • Condition: "item > 50.00"
    • List Object Attribute: (Left empty, as the list contains simple numbers)
  • Result: The Result will be "60.50".

Example 2: Locating the first customer from a specific city

You have a list of customer records, and each record includes a customer's name and city. You need to find the first customer who lives in "New York".

  • Inputs:
    • List: [ \{ "name": "Alice", "city": "London" \}, \{ "name": "Bob", "city": "New York" \}, \{ "name": "Charlie", "city": "Paris" \}, \{ "name": "David", "city": "New York" \} ]
    • Condition: "item == 'New York'"
    • List Object Attribute: "city"
  • Result: The Result will be "\{ \"name\": \"Bob\", \"city\": \"New York\" \}".

Example 3: Identifying the first task marked as "Urgent"

You have a list of tasks, and each task has a status. You want to find the very first task that has a status of "Urgent".

  • Inputs:
    • List: [ \{ "id": 1, "description": "Review report", "status": "Pending" \}, \{ "id": 2, "description": "Fix bug", "status": "Urgent" \}, \{ "id": 3, "description": "Plan meeting", "status": "Completed" \} ]
    • Condition: "item == 'Urgent'"
    • List Object Attribute: "status"
  • Result: The Result will be "\{ \"id\": 2, \"description\": \"Fix bug\", \"status\": \"Urgent\" \}".

Example 4: When no match is found

If your condition doesn't match any item in the list, the action will still complete, but the output will be empty.

  • Inputs:
    • List: ["Apple", "Banana", "Orange"]
    • Condition: "item == 'Grape'"
    • List Object Attribute: (Left empty)
  • Result: The Result will be empty ("").