Fetch records for datatable
Function: Fetch records for datatable
This action allows you to retrieve data from your database and display it within a specific table (datatable) on your application's user interface. You can define which type of data to fetch, apply various filters, select specific information to display, and sort the results.
Input
- UI element (Required, Type: UI element) The specific table (datatable) on your page where the fetched records will be displayed.
- Data format (Required, Type: Data Format) The type of data you want to retrieve (e.g., "Products", "Customers", "Orders"). This defines the structure of the records you're looking for.
- Filters (Optional, Type: List of Filters)
A set of conditions that all records must meet to be included. If you add multiple filters here, they will all apply simultaneously (AND relationship).
- Attribute: The specific field within your data format to check (e.g., "Price", "Status", "Category").
- Operator: How the attribute should be compared to a value (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: The value to compare against the attribute. This field appears only if the selected operator is not "Is null" or "Is not null".
- Filters (OR) (Optional, Type: List of Filters)
A set of conditions where records will be included if they meet any of these conditions (OR relationship). If you add multiple filters here, a record will be shown if it matches at least one of them.
- Attribute: The specific field within your data format to check.
- Operator: How the attribute should be compared to a value.
- 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: The value to compare against the attribute. This field appears only if the selected operator is not "Is null" or "Is not null".
- Attributes (Optional, Type: List of Attributes)
Specify which fields (attributes) from your data format you want to retrieve and display. If left empty, all available attributes will be fetched.
- Attribute: The specific field you want to include.
- Sort by (Optional, Type: List of Sort Rules)
Define how the fetched records should be ordered in the datatable. You can add multiple sorting rules.
- Attribute: The field by which to sort the records.
- Order: The direction of sorting.
- Options: Ascending, Descending.
- Clear datatable (Optional, Type: True/False, Default:
false
) If set toTrue
, all existing records in the datatable will be removed before the new records are added. IfFalse
, the new records will be added to the existing ones. - Hide the identifier column (Optional, Type: True/False, Default:
true
) Determines whether the unique identifier (ID) column for each record should be visible in the datatable. IfTrue
, the ID column will be hidden.
Output
- Updated UI element The specified datatable UI element will be updated with the fetched records, filtered, sorted, and displayed according to your configurations.
Execution Flow
Real-Life Examples
Example 1: Displaying Active Products
Imagine you have an e-commerce application and want to show only products that are currently "Active" and have a "Price" greater than $50 in your product listing table.
- Inputs:
- UI element:
Product Listing Table
- Data format:
Products
- Filters:
- Add filter 1:
- Attribute:
Status
- Operator:
Equal
- Value:
Active
- Attribute:
- Add filter 2:
- Attribute:
Price
- Operator:
Greater than
- Value:
50
- Attribute:
- Add filter 1:
- Attributes: (Leave empty to show all product details)
- Sort by:
- Add sorting rule 1:
- Attribute:
Name
- Order:
Ascending
- Attribute:
- Add sorting rule 1:
- Clear datatable:
True
- Hide the identifier column:
True
- UI element:
- Result: The
Product Listing Table
will be cleared, then populated with all "Active" products costing more than $50, sorted alphabetically by their name. The product ID column will not be visible.
Example 2: Showing Recent Customer Orders
You want to display recent orders from a specific customer or any orders placed today in a customer's order history table.
- Inputs:
- UI element:
Customer Order History Table
- Data format:
Orders
- Filters: (Leave empty)
- Filters (OR):
- Add filter 1:
- Attribute:
CustomerID
- Operator:
Equal
- Value:
[Current Customer ID]
(assuming this is a variable holding the current customer's ID)
- Attribute:
- Add filter 2:
- Attribute:
OrderDate
- Operator:
Equal
- Value:
[Today's Date]
(assuming this is a variable holding the current date)
- Attribute:
- Add filter 1:
- Attributes:
- Add attribute 1:
OrderNumber
- Add attribute 2:
OrderDate
- Add attribute 3:
TotalAmount
- Add attribute 1:
- Sort by:
- Add sorting rule 1:
- Attribute:
OrderDate
- Order:
Descending
- Attribute:
- Add sorting rule 1:
- Clear datatable:
True
- Hide the identifier column:
False
- UI element:
- Result: The
Customer Order History Table
will be cleared, then display orders belonging to the current customer OR any orders placed today. Only the Order Number, Order Date, and Total Amount will be shown, sorted with the most recent orders first. The order ID column will be visible.
Example 3: Listing Employees by Department
You need to show all employees from the "Sales" or "Marketing" department in an employee directory table, without clearing existing entries, and only displaying their name and email.
- Inputs:
- UI element:
Employee Directory Table
- Data format:
Employees
- Filters: (Leave empty)
- Filters (OR):
- Add filter 1:
- Attribute:
Department
- Operator:
Equal
- Value:
Sales
- Attribute:
- Add filter 2:
- Attribute:
Department
- Operator:
Equal
- Value:
Marketing
- Attribute:
- Add filter 1:
- Attributes:
- Add attribute 1:
FullName
- Add attribute 2:
EmailAddress
- Add attribute 1:
- Sort by:
- Add sorting rule 1:
- Attribute:
FullName
- Order:
Ascending
- Attribute:
- Add sorting rule 1:
- Clear datatable:
False
- Hide the identifier column:
True
- UI element:
- Result: The
Employee Directory Table
will retain its current entries, and then new entries for employees from either the "Sales" or "Marketing" department will be added. Only their full name and email address will be displayed, sorted alphabetically by full name. The employee ID column will be hidden.