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 collection of data records 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 fields to include, and define how the results should be sorted. The data is returned in pages, making it efficient to handle large datasets.

Input

  • Data format: The specific type of data (e.g., "Products", "Customers", "Orders") you want to retrieve records for. This is a required selection.
  • Page: The page number of the results you wish to fetch. Counting starts from 0 for the first page. If not specified, it defaults to page 0.
  • Amount per page: The maximum number of records to include on each page of results. If not specified, it defaults to 10 records per page.
  • Filters: A list of conditions that records must meet, all of which must be true (AND relationship).
    • Attribute: The specific field within your data format (e.g., "Product Name", "Price", "Status") to apply the filter to.
    • Operator: How the attribute should be compared to a value (e.g., "Equal", "Greater than", "Contains").
      • Available operators: 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: The value to compare against the selected attribute. This input is hidden if the operator is "Is null" or "Is not null".
  • Filters (OR): A list of conditions where at least one must be true (OR relationship).
    • Attribute: The specific field within your data format to apply the filter to.
    • Operator: How the attribute should be compared to a value.
    • Value: The value to compare against the selected attribute. This input is hidden if the operator is "Is null" or "Is not null".
  • Attributes: A list of specific fields you want to retrieve for each record. If you don't specify any, all fields will be included.
    • Attribute: The field you want to include in the results.
  • Sort by: A list of rules to determine the order of the retrieved records.
    • Attribute: The field by which to sort the results.
    • Order: The direction of sorting.
      • Available options: Ascending (A-Z, 0-9), Descending (Z-A, 9-0).

Output

  • Found data page: A variable that will hold the collection of data records retrieved from the database, structured as a page. By default, this variable is named FOUND_DATA.

Execution Flow

Real-Life Examples

Example 1: Find active products under a certain price

Goal: Retrieve the first page of products that are currently "Active" and cost less than $50, sorted by their name in ascending order.

Inputs:

  • Data format: Products
  • Page: 0
  • Amount per page: 20
  • Filters:
    • Add filter 1:
      • Attribute: Status
      • Operator: Equal
      • Value: Active
    • Add filter 2:
      • Attribute: Price
      • Operator: Less than
      • Value: 50
  • Sort by:
    • Add sorting rule 1:
      • Attribute: ProductName
      • Order: Ascending

Result: The FOUND_DATA variable will contain a page of up to 20 product records where each product is active, costs less than $50, and the list is ordered alphabetically by product name.

Example 2: Get customer contact details from specific regions

Goal: Fetch the second page of customer records, including only their name and email, for customers located in either "Europe" or "North America".

Inputs:

  • Data format: Customers
  • Page: 1
  • Amount per page: 15
  • Filters (OR):
    • Add filter 1:
      • Attribute: Region
      • Operator: Equal
      • Value: Europe
    • Add filter 2:
      • Attribute: Region
      • Operator: Equal
      • Value: North America
  • Attributes:
    • Add attribute 1: CustomerName
    • Add attribute 2: EmailAddress

Result: The FOUND_DATA variable will store the second page (records 16-30) of customer information. Each record will only include the CustomerName and EmailAddress fields, and all customers will be from either Europe or North America.

Example 3: List all tasks that are not yet completed

Goal: Retrieve all tasks that are not marked as "Completed", without any specific page limits, and check if their DueDate is not null.

Inputs:

  • Data format: Tasks
  • Page: 0 (default)
  • Amount per page: 9999 (or a very large number to get all, or leave default and loop through pages)
  • Filters:
    • Add filter 1:
      • Attribute: Status
      • Operator: Not equal
      • Value: Completed
    • Add filter 2:
      • Attribute: DueDate
      • Operator: Is not null
  • Sort by: (None specified, results will be in default database order)

Result: The FOUND_DATA variable will contain a page of task records where the Status is anything other than "Completed" and a DueDate has been assigned.