Ask AI
Skip to main content

Fetch data record by ID

Function: Fetch data record by ID

This function allows you to retrieve a single record from your application's built-in database using its unique identifier. It's useful when you need to display specific information or use it in further actions within your application.

Input,

  • Record ID (DATA-ID): This is the unique identifier for the specific data record you want to find (e.g., a customer ID, a product code). You must provide this ID.
  • Data Type (DATA-FORMAT): This specifies the type or structure of the data record you are looking for (e.g., "Customers", "Products", "Orders"). You must select an existing data type from your application.
  • Attributes to Fetch (DATA-FORMAT-ATTRIBUTES): (Optional) By default, this function fetches all available information (attributes) for the record. If you only need specific pieces of information (like "Customer Name" or "Product Price"), you can choose them here. This helps your application run more efficiently by only loading necessary data.

Output,

  • Found Data (DATA): This is a variable that will hold the entire data record found in the database. If no record matching the provided ID and Data Type is found, this variable will be empty. By default, this variable is named FOUND_DATA, but you can change it to something more descriptive.

Execution Flow,

Real-Life Examples,

  1. Displaying Customer Details on a Profile Page

    • Inputs:
      • Record ID: CUST-001 (The ID of a specific customer)
      • Data Type: Customers (The data type that defines customer information)
      • Attributes to Fetch: (Left empty to get all customer details)
    • Result: The system retrieves all details for the customer with ID CUST-001 (e.g., name, address, phone number) and stores them in a variable named FOUND_DATA. This data can then be used to populate fields on a customer profile page.
  2. Checking Product Stock for an E-commerce Order

    • Inputs:
      • Record ID: PROD-XYZ (The ID of a specific product)
      • Data Type: Products (The data type that defines product information)
      • Attributes to Fetch: StockQuantity, ProductName (Only these two attributes are needed)
    • Result: The system retrieves only the StockQuantity and ProductName for the product with ID PROD-XYZ and stores them in FOUND_DATA. This allows the application to quickly check if a product is in stock without loading unnecessary details like product descriptions or images.
  3. Fetching Order Information for Status Update

    • Inputs:
      • Record ID: ORD-456 (The ID of a specific order)
      • Data Type: Orders (The data type that defines order information)
      • Attributes to Fetch: (Left empty to get all order details)
    • Result: The system retrieves the full order record for ORD-456 and stores it in FOUND_DATA. You can then use another action to modify the Status attribute of this FOUND_DATA variable (e.g., from "Pending" to "Shipped") and save the updated record back to the database.