Ask AI
Skip to main content

Fetch from ext. database

Function: Fetch from ext. database

This action allows you to retrieve one or more records from an external database. You can specify which table to query, apply filters to narrow down the results, and select specific pieces of information (attributes) you want to fetch.

Input

  • Database connection: Details required to connect to your external database.
    • Type: Choose the type of database (e.g., MSSQL, MYSQL).
    • Server: The address or hostname of the database server.
    • Database: The name of the specific database you want to connect to.
    • User: The username for accessing the database.
    • Password: The password for the database user.
    • Port: The port number used for the database connection (e.g., 1433 for MSSQL, 3306 for MySQL).
  • Table: The name of the table in the external database from which you want to retrieve records.
  • Data format: (Optional) Defines the structure of the data you expect to retrieve. This helps in setting up filters and selecting attributes.
  • Filters: (Optional) A list of conditions to apply to the records. Only records that match all specified conditions will be retrieved.
    • Attribute: Select a specific field (column) from your data format to filter by.
    • Operator: Choose how the attribute should be compared (e.g., Equal, Greater than, Contains).
    • Value: The value to compare against the selected attribute.
  • Attributes: (Optional) Select specific fields (columns) you want to retrieve from the table. If left empty, all fields will be fetched.

Output

  • Result: A list of records retrieved from the external database that match your criteria. Each record will contain the selected attributes.

Execution Flow

Real-Life Examples

Example 1: Fetching All Active Customers

Goal: Retrieve all customer records from the Customers table where the Status is 'Active'.

Inputs:

  • Database connection:
    • Type: MYSQL
    • Server: my.database.server.com
    • Database: crm_db
    • User: admin
    • Password: mySecurePassword
    • Port: 3306
  • Table: Customers
  • Data format: (Assumes a Customer data format exists with a Status attribute)
  • Filters:
    • Attribute: Status
    • Operator: Equal
    • Value: Active
  • Attributes: (Leave empty to fetch all customer details)

Result: The Result variable will contain a list of all customer records whose status is 'Active', including all their details (e.g., Name, Email, Address, etc.).

Example 2: Finding Products with Low Stock

Goal: Get the ProductName and StockLevel for all products in the Products table where the StockLevel is less than 10.

Inputs:

  • Database connection: (Same as Example 1)
  • Table: Products
  • Data format: (Assumes a Product data format exists with ProductName and StockLevel attributes)
  • Filters:
    • Attribute: StockLevel
    • Operator: Less than
    • Value: 10
  • Attributes:
    • ProductName
    • StockLevel

Result: The Result variable will contain a list of objects, each with ProductName and StockLevel for products that have less than 10 units in stock.

Example 3: Retrieving Orders from a Specific Date Range

Goal: Fetch all orders placed between January 1st, 2023, and January 31st, 2023, from the Orders table.

Inputs:

  • Database connection: (Same as Example 1)
  • Table: Orders
  • Data format: (Assumes an Order data format exists with an OrderDate attribute)
  • Filters:
    • Filter 1:
      • Attribute: OrderDate
      • Operator: Greater than or equal
      • Value: 2023-01-01
    • Filter 2:
      • Attribute: OrderDate
      • Operator: Less than or equal
      • Value: 2023-01-31
  • Attributes: (Leave empty to fetch all order details)

Result: The Result variable will contain a list of all order records that were placed within the month of January 2023.