Fetch data record by ID
Function: Fetch data record by ID
This function allows you to retrieve a single data record from your built-in database using its unique identifier. It's useful when you need to access specific information, like a customer's details or a product's specifications, based on an ID you already have.
Input
- Id (Text, Required): This is the unique identifier for the specific data record you want to find. Think of it like a serial number or a customer ID.
- Data Collection (Data Collection, Required): This specifies the type or category of data you are looking for (e.g., "Customers", "Products", "Orders"). You must tell the system which collection to search within.
- Attributes (List of Specific Fields, Optional): This is a list of particular fields you want to retrieve from the data record. If you don't specify any attributes, the system will fetch all available fields for that record.
- Specific Field (Specific Field): An individual field within your chosen Data Collection (e.g., "Customer Name", "Product Price", "Order Date").
Output
- Data variable name (Data, Optional): This is the name of the variable where the found data record will be stored. If no record is found with the provided ID, this variable will be empty. By default, this variable is named
FOUND_DATA.
Execution Flow
Real-Life Examples
Example 1: Fetching a complete customer record
Imagine you have a customer ID and want to display all their information on a profile page.
- Inputs:
- Id:
CUST-001 - Data Collection:
Customers - Attributes: (Left empty, meaning all attributes will be fetched)
- Id:
- Result: The system finds the customer record with ID
CUST-001from theCustomerscollection. All its details (like Name, Address, Phone, Email) are stored in a variable namedFOUND_DATA, which you can then use to populate your customer profile page.
Example 2: Fetching specific product details for a display card
You want to show a product card that only displays the product name, price, and stock quantity, not all its technical specifications.
- Inputs:
- Id:
PROD-XYZ-456 - Data Collection:
Products - Attributes:
Product NamePriceStock Quantity
- Id:
- Result: The system retrieves the product record
PROD-XYZ-456from theProductscollection. Only theProduct Name,Price, andStock Quantityfields are extracted and stored in theFOUND_DATAvariable. This variable now contains just the essential information for your product card.
Example 3: Checking if an order exists
Before processing a return, you want to verify if a given order ID actually exists in your system.
- Inputs:
- Id:
ORDER-9999 - Data Collection:
Orders - Attributes: (Left empty, as you only need to know if it exists)
- Id:
- Result: The system searches for
ORDER-9999in theOrderscollection. If no record with this ID is found, theFOUND_DATAvariable will be set to empty. You can then use a condition (e.g., "IfFOUND_DATAis empty...") to display a message like "Order not found."