Find first match by formula
Function: Find first match by formula
This action helps you search through a list of items and find the very first one that matches a specific rule or condition you define. It's useful when you need to quickly pinpoint a particular item in a collection, such as finding the first customer with an overdue payment or the first product below a certain price.
Input
- List (A list of values): The collection of items you want to search through. This could be a list of numbers, text, or even more complex objects like customer records or product details.
- Condition (A piece of text): The rule or formula that an item must satisfy to be considered a match. For example, if you have a list of numbers, your condition could be
item > 10to find the first number greater than 10. If your list contains objects, you might useitem.price < 50. - List Object Attribute (A piece of text, Optional): If your list contains complex items (like customer records or product details), this is the specific part (attribute) of each item you want to apply your condition to. For example, if your list is of "Products" and you want to check their "Price", you would enter
Pricehere. If your list contains simple values (like just numbers or text), you can leave this blank.
Output
- Result (A piece of text): The first item from your list that successfully meets your specified condition. If no item matches the condition, this output will be empty.
Execution Flow
Real-Life Examples
Example 1: Finding the first product that is out of stock
Imagine you have a list of products and you want to quickly identify the first one that is currently out of stock.
- Inputs:
- List:
[Product A \(in stock\), Product B \(out of stock\), Product C \(in stock\), Product D \(out of stock\)] - Condition:
item.status == 'out of stock' - List Object Attribute:
status
- List:
- Result:
Product B \(out of stock\)
Example 2: Identifying the first customer with an overdue invoice
You have a list of customer records, each with an invoiceStatus attribute, and you need to find the first customer whose invoice is overdue.
- Inputs:
- List:
[Customer 1 \(invoiceStatus: Paid\), Customer 2 \(invoiceStatus: Overdue\), Customer 3 \(invoiceStatus: Pending\)] - Condition:
item.invoiceStatus == 'Overdue' - List Object Attribute:
invoiceStatus
- List:
- Result:
Customer 2 \(invoiceStatus: Overdue\)
Example 3: Locating the first task assigned to a specific team member
You have a list of tasks, and each task has an assignedTo attribute. You want to find the first task assigned to "John Doe".
- Inputs:
- List:
[Task 1 \(assignedTo: Jane\), Task 2 \(assignedTo: John Doe\), Task 3 \(assignedTo: Jane\), Task 4 \(assignedTo: John Doe\)] - Condition:
item.assignedTo == 'John Doe' - List Object Attribute:
assignedTo
- List:
- Result:
Task 2 \(assignedTo: John Doe\)