Ask AI
Skip to main content

Search one data record

Function: Search one data record

This action helps you find a single item from your database. You can specify which type of data you're looking for, apply various filters to narrow down the search, choose specific pieces of information (attributes) to retrieve, and even decide how the results should be ordered. The first matching record found will be returned.

Input

  • Data format: The type of data you want to search within (e.g., "Customers", "Products", "Orders"). This is a required input.
  • Filters (AND): A list of conditions that all must be true for a data record to be considered. For example, "Status is 'Active' AND City is 'New York'". You can add multiple filters, and each one will be applied together.
    • Attribute: The specific field in your data format to check (e.g., "Product Name", "Order Date").
    • Operator: How the attribute should be compared (e.g., "Equal", "Greater than", "Contains").
    • Value: The value to compare against (e.g., "Laptop", "2023-01-01", "urgent"). The type of this value will adapt to the selected attribute.
  • Filters (OR): A list of conditions where at least one must be true for a data record to be considered. For example, "Status is 'Pending' OR Priority is 'High'". You can add multiple OR filters, and if any of them are met, the record will match. If both AND and OR filters are provided, the AND filters are applied first, and then the OR filters are applied to the results of the AND filters.
    • Attribute: The specific field in your data format to check.
    • Operator: How the attribute should be compared.
    • Value: The value to compare against. The type of this value will adapt to the selected attribute.
  • Attributes: A list of specific fields you want to retrieve from the matching data record. If you don't specify any, all fields will be retrieved. This is useful if you only need a few pieces of information and want to keep your data lightweight.
    • Attribute: The specific field you want to include in the result.
  • Sort by: How you want the matching data records to be ordered before the first one is selected. This is useful if you want to ensure you get the "newest", "oldest", "highest priced", etc., record.
    • Attribute: The field to sort by (e.g., "Creation Date", "Price").
    • Order: Whether to sort in "Ascending" (A-Z, 0-9) or "Descending" (Z-A, 9-0) order.

Output

  • Found data: A variable that will store the first data record found that matches all your criteria. If no record is found, this variable will be empty. By default, this variable is named FOUND_DATA, but you can change it.

Execution Flow

Real-Life Examples

Example 1: Find an active customer by email

  • Goal: Retrieve the details of a specific customer who is currently active, using their email address.
  • Inputs:
    • Data format: Customers
    • Filters (AND):
      • Attribute: Email, Operator: Equal, Value: [email protected]
      • Attribute: Status, Operator: Equal, Value: Active
    • Attributes: (empty, retrieve all fields)
    • Sort by: (empty)
  • Result: The FOUND_DATA variable will contain the complete record for the active customer with the email [email protected]. If no such customer exists or they are not active, FOUND_DATA will be empty.

Example 2: Find the most recent high-priority task

  • Goal: Get the details of the single most recently created task that has a "High" priority.
  • Inputs:
    • Data format: Tasks
    • Filters (AND):
      • Attribute: Priority, Operator: Equal, Value: High
    • Attributes:
      • Attribute: Task Name
      • Attribute: Due Date
      • Attribute: Assigned To
    • Sort by:
      • Attribute: Creation Date, Order: Descending
  • Result: The FOUND_DATA variable will hold an object containing the Task Name, Due Date, and Assigned To for the single most recently created task with "High" priority.

Example 3: Find a product that is either on sale or has low stock

  • Goal: Identify a product that needs attention because it's either part of a current sale or its stock level is below a certain threshold.
  • Inputs:
    • Data format: Products
    • Filters (AND): (empty)
    • Filters (OR):
      • Attribute: On Sale, Operator: Equal, Value: True
      • Attribute: Stock Level, Operator: Less than, Value: 10
    • Attributes:
      • Attribute: Product Name
      • Attribute: Price
      • Attribute: Stock Level
      • Attribute: On Sale
    • Sort by:
      • Attribute: Product Name, Order: Ascending
  • Result: The FOUND_DATA variable will contain the Product Name, Price, Stock Level, and On Sale status of the first product found (alphabetically by name) that is either on sale or has a stock level less than 10.