Ask AI
Skip to main content

Fetch records for datatable

Function: Fetch records for datatable

This action allows you to retrieve data from your database and display it within a Data Table user interface element. You can specify which data source to use, apply various filters to narrow down the results, select only specific fields to display, and define the order in which the records should appear. This is perfect for populating lists, reports, or any dynamic table in your application.

Input

  • UI element (PART, required): The specific Data Table component on your page where the fetched records will be displayed.
  • Data format (DATA_FORMAT, required): The data source (like a database table or collection) from which you want to retrieve the records.
  • Filters (ARRAY of OBJECTs): A set of conditions that records must meet, all of which must be true (AND relationship), to be included in the Data Table. You can add multiple filter rules.
    • Attribute: The field in your data format to check.
    • Operator: How the attribute should be compared (e.g., "Equal", "Greater than", "Contains").
    • Value: The value to compare against the attribute. This input is hidden if the selected operator is "Is null" or "Is not null".
  • Filters (OR) (ARRAY of OBJECTs): A set of conditions where at least one must be true (OR relationship) for a record to be included. These OR filters are applied after any "AND" filters. You can add multiple filter rules.
    • Attribute: The field in your data format to check.
    • Operator: How the attribute should be compared.
    • Value: The value to compare against the attribute. This input is hidden if the selected operator is "Is null" or "Is not null".
  • Attributes (ARRAY of OBJECTs): Specify which specific fields from your data format you want to retrieve and display. If this list is left empty, all fields from the data format will be fetched. You can add multiple attributes.
    • Attribute: The specific field you want to include.
  • Sort by (ARRAY of OBJECTs): Define the order in which the records should be displayed in the Data Table. You can add multiple sorting rules.
    • Attribute: The field by which to sort the records.
    • Order: The sorting direction ("Ascending" or "Descending").
  • Clear datatable (BOOLEAN, default: false): If set to True, any existing data in the Data Table will be removed before the new records are added. If False, the new records will be appended to the existing ones.
  • Hide the identifier column (BOOLEAN, default: true): If set to True, the unique identifier (ID) column for each record will not be visible in the Data Table. If False, the ID column will be shown.

Output

This action directly updates the specified Data Table UI element on your page with the fetched records. There is no direct output variable that can be used in subsequent actions.

Execution Flow

Real-Life Examples

Example 1: Displaying All Active Users

  • Scenario: You want to show a list of all active users in your application on an admin dashboard.
  • Inputs:
    • UI element: UserListTable (a Data Table component on your dashboard)
    • Data format: Users
    • Filters:
      • Attribute: Status
      • Operator: Equal
      • Value: Active
    • Attributes:
      • FirstName
      • LastName
      • Email
    • Sort by:
      • Attribute: LastName
      • Order: Ascending
    • Clear datatable: True
    • Hide the identifier column: True
  • Result: The UserListTable will be cleared, then populated with the first name, last name, and email of all users whose status is "Active", sorted alphabetically by their last name. The user ID column will not be visible.

Example 2: Viewing Recent High-Value Orders

  • Scenario: You need to see a list of orders placed in the last 7 days with a total value greater than $500, sorted by order date (newest first).
  • Inputs:
    • UI element: HighValueOrdersTable
    • Data format: Orders
    • Filters:
      • Attribute: OrderDate
      • Operator: Greater than or equal
      • Value: [Current Date - 7 Days] (a variable representing 7 days ago)
      • Attribute: TotalAmount
      • Operator: Greater than
      • Value: 500
    • Attributes:
      • OrderID
      • CustomerName
      • OrderDate
      • TotalAmount
    • Sort by:
      • Attribute: OrderDate
      • Order: Descending
    • Clear datatable: True
    • Hide the identifier column: False
  • Result: The HighValueOrdersTable will display orders from the last 7 days with a total amount over $500. Each row will show the Order ID, Customer Name, Order Date, and Total Amount, sorted from the newest order to the oldest. The Order ID column will be visible.

Example 3: Finding Products by Category or Stock Level

  • Scenario: You want to find products that are either in the "Electronics" category OR have more than 100 units in stock, and display their name and current stock.
  • Inputs:
    • UI element: ProductSearchTable
    • Data format: Products
    • Filters (OR):
      • Attribute: Category
      • Operator: Equal
      • Value: Electronics
      • Attribute: StockLevel
      • Operator: Greater than
      • Value: 100
    • Attributes:
      • ProductName
      • StockLevel
    • Clear datatable: True
    • Hide the identifier column: True
  • Result: The ProductSearchTable will be updated to show the product name and stock level for all products that are categorized as "Electronics" or have a stock level greater than 100. The product ID column will not be visible.