Ask AI
Skip to main content

Fetch a list of data records

Function: Fetch a list of data records

This action allows you to retrieve a list of data entries from your application's built-in database. You can specify which type of data you want, apply various filters to narrow down the results, choose which specific pieces of information (attributes) to fetch, and define how the results should be sorted. The data is returned in pages, making it easy to handle large datasets.

Input

  • Data format: The specific type of data you want to retrieve (e.g., "Products", "Customers", "Orders"). This is a required input.
  • Page: The page number of the results you want to fetch. The first page is 0. By default, this is set to 0.
  • Amount per page: The maximum number of data entries to include on each page. By default, this is set to 10.
  • Filters: A list of conditions that all must be true for a data entry to be included in the results. Each filter consists of:
    • Attribute: The specific field within your data format (e.g., "Product Name", "Price", "Status").
    • Operator: How the attribute should be compared to a value (e.g., "Equal", "Greater than", "Contains", "Is null").
    • Value: The value to compare against the attribute. This input is not needed if the operator is "Is null" or "Is not null".
  • Filters (OR): A list of conditions where at least one must be true for a data entry to be included in the results. These filters work independently of the "Filters" (AND) list. Each filter consists of:
    • Attribute: The specific field within your data format.
    • Operator: How the attribute should be compared to a value.
    • Value: The value to compare against the attribute. This input is not needed if the operator is "Is null" or "Is not null".
  • Attributes: A list of specific fields you want to retrieve for each data entry. If you don't specify any, all fields will be fetched.
  • Sort by: A list of rules to determine the order of the retrieved data entries. Each rule consists of:
    • Attribute: The field by which to sort the results.
    • Order: Whether to sort in "Ascending" (A-Z, 0-9) or "Descending" (Z-A, 9-0) order.

Output

  • Found data page: A variable that will store the retrieved page of data entries. By default, this variable is named FOUND_DATA.

Execution Flow

Real-Life Examples

Example 1: Find active products on the first page

Goal: Retrieve the first page of products that are currently "Active".

Inputs:

  • Data format: Products
  • Page: 0
  • Amount per page: 10
  • Filters:
    • Attribute: Status
    • Operator: Equal
    • Value: Active

Result: The FOUND_DATA variable will contain the first 10 products from your database that have a Status of Active.

Example 2: Get customer names from New York or California, sorted by last name

Goal: Fetch the names of customers located in "New York" or "California", specifically retrieving only their first and last names, sorted alphabetically by their last name.

Inputs:

  • Data format: Customers
  • Page: 0
  • Amount per page: 20
  • Filters (OR):
    • Filter 1:
      • Attribute: City
      • Operator: Equal
      • Value: New York
    • Filter 2:
      • Attribute: State
      • Operator: Equal
      • Value: California
  • Attributes:
    • FirstName
    • LastName
  • Sort by:
    • Attribute: LastName
    • Order: Ascending

Result: The FOUND_DATA variable will hold up to 20 customer records, each containing only their FirstName and LastName. These customers will be from either New York or California, and the list will be sorted alphabetically by their LastName.

Example 3: Retrieve recent orders placed in the last 7 days, showing only order ID and date

Goal: Get the order ID and order date for all orders placed within the last 7 days, on the second page of results.

Inputs:

  • Data format: Orders
  • Page: 1
  • Amount per page: 5
  • Filters:
    • Attribute: OrderDate
    • Operator: Greater than or equal
    • Value: [Current Date - 7 Days] (This would typically be a dynamic value calculated by another action or expression)
  • Attributes:
    • OrderID
    • OrderDate

Result: The FOUND_DATA variable will contain the second page (up to 5 records) of orders placed in the last 7 days, with each record showing only the OrderID and OrderDate.