Ask AI
Skip to main content

Search one data record

Function: Search one data record

This function allows you to find a single item from your database based on specific criteria. You can define various filters to narrow down your search, specify which pieces of information (attributes) you want to retrieve, and even decide how the results should be ordered before picking the first one. It's perfect for when you need to locate a very specific record, like a particular customer, product, or order.

Input

  • Data format
    • Description: Choose the type of data you want to search within (e.g., "Customers", "Products", "Orders").
    • Type: DATA_FORMAT
    • Required: Yes
  • Filters
    • Description: Set up rules to find data records that match ALL of your conditions. Each rule checks a specific piece of information (attribute) in your data.
    • Type: ARRAY of OBJECTs
    • Each filter item includes:
      • Attribute: Select the specific field (e.g., "Customer Name", "Product Price") you want to check.
      • Operator: Choose how the attribute should be compared (e.g., "Equal", "Greater than", "Contains").
        • Options: Equal, Greater than, Greater than or equal, In, Less than, Less than or equal, Not equal, Not in, Contains, Contains (ignore case), Starts with, Ends with, Is null, Is not null.
      • Value: Provide the value to compare against the attribute. This field is hidden if the operator is "Is null" or "Is not null".
  • Filters (OR)
    • Description: Set up rules to find data records that match ANY of your conditions. If you use both "Filters" (AND) and "Filters (OR)", the system will first apply all "AND" filters, and then apply the "OR" filters to the results.
    • Type: ARRAY of OBJECTs
    • Each filter item includes:
      • Attribute: Select the specific field you want to check.
      • Operator: Choose how the attribute should be compared.
        • Options: Equal, Greater than, Greater than or equal, In, Less than, Less than or equal, Not equal, Not in, Contains, Contains (ignore case), Starts with, Ends with, Is null, Is not null.
      • Value: Provide the value to compare against the attribute. This field is hidden if the operator is "Is null" or "Is not null".
  • Attributes
    • Description: Specify which specific pieces of information (attributes) you want to retrieve from the found data record. If left empty, all attributes will be returned.
    • Type: ARRAY of OBJECTs
    • Each attribute item includes:
      • Attribute: Select the field you want to include in the result.
  • Sort by
    • Description: Define the order in which the data records should be arranged before the first one is selected. You can add multiple sorting rules.
    • Type: ARRAY of OBJECTs
    • Each sort item includes:
      • Attribute: Select the field by which to sort the results.
      • Order: Choose whether to sort in "Ascending" (A-Z, 0-9) or "Descending" (Z-A, 9-0) order.

Output

  • Found data
    • Description: The single data record that matches your criteria, stored in a variable.
    • Type: DATA
    • Default Value: FOUND_DATA

Execution Flow

Real-Life Examples

Example 1: Find a specific product by its unique ID

Imagine you have an e-commerce application and you need to quickly retrieve the details of a product using its product code.

  • Inputs:
    • Data format: Products
    • Filters:
      • Attribute: ProductCode
      • Operator: Equal
      • Value: P-00123
    • Attributes: (Leave empty to get all product details)
    • Sort by: (Leave empty as you expect only one match)
  • Result: The system finds the product with the code P-00123 and stores all its details in the FOUND_DATA variable.

Example 2: Find the most recently updated customer in a specific city

You want to find the details of a customer who lives in "New York" and whose record was updated most recently.

  • Inputs:
    • Data format: Customers
    • Filters:
      • Attribute: City
      • Operator: Equal
      • Value: New York
    • Attributes: (Leave empty to get all customer details)
    • Sort by:
      • Attribute: LastUpdatedDate
      • Order: Descending
  • Result: The system finds the customer record from "New York" that has the latest LastUpdatedDate and stores it in the FOUND_DATA variable.

Example 3: Find an order that is either "Pending" or "Processing", and only get its ID and Status

You need to quickly check for any order that is currently awaiting fulfillment or being processed, but you only care about its unique identifier and current status.

  • Inputs:
    • Data format: Orders
    • Filters (OR):
      • Attribute: OrderStatus
      • Operator: Equal
      • Value: Pending
      • Attribute: OrderStatus
      • Operator: Equal
      • Value: Processing
    • Attributes:
      • Attribute: OrderID
      • Attribute: OrderStatus
    • Sort by: (Leave empty)
  • Result: The system finds the first order record that is either "Pending" or "Processing" and stores only its OrderID and OrderStatus in the FOUND_DATA variable.