Fetch from ext. database
Function: Fetch from ext. database
This function allows you to retrieve one or more records from an external database that is not directly part of your application. You can specify which table to query, apply filters to narrow down the results, and choose specific columns to fetch.
Input
- Database connection: These are the essential details required to establish a link with your external database.
- Type: Choose the kind of database you are connecting to (e.g., MSSQL, MYSQL).
- Server: The network address or name of the computer hosting your database.
- Database: The specific name of the database you wish to access on the server.
- User: The username for logging into the database.
- Password: The password associated with the database username.
- Port: The specific communication port number used by the database server.
- Table: The exact name of the table within your external database from which you want to retrieve information.
- Data format: This defines the expected structure of the data you're fetching, helping the platform understand the columns and their types. This is crucial if you plan to use filters or select specific attributes.
- Filters: Use these conditions to specify which records you want to retrieve. You can add multiple filters to refine your search.
- Each filter consists of:
- Attribute: The specific column in your table that you want to check.
- Operator: How the attribute should be compared (e.g., "Equal" to find exact matches, "Greater than" for numerical comparisons, "Contains" for text searches).
- Value: The data you want to compare against the chosen attribute.
- Each filter consists of:
- Attributes: A list of specific columns you want to see in the results. If you leave this empty, the function will retrieve all columns from the matching records.
Output
- Result: The records that were successfully fetched from the external database, presented as a list of data entries. This output will be stored in a variable, by default named
QUERY_RESULT.
Execution Flow
Real-Life Examples
Example 1: Fetching all active customer orders
Scenario: You want to get a list of all customer orders that are currently marked as "Active" from your external orders database.
Inputs:
- Database connection:
- Type:
MYSQL - Server:
myordersdb.example.com - Database:
customer_orders - User:
order_user - Password:
secure_password123 - Port:
3306
- Type:
- Table:
Orders - Data format:
Order_Schema(defines columns likeOrderID,CustomerID,Status,OrderDate,TotalAmount) - Filters:
- Filter 1:
- Attribute:
Status - Operator:
Equal - Value:
Active
- Attribute:
- Filter 1:
- Attributes: (Leave empty to fetch all columns)
Result: The QUERY_RESULT variable will contain a list of all orders from the Orders table where the Status is 'Active', including all their details (OrderID, CustomerID, OrderDate, TotalAmount, etc.).
Example 2: Retrieving specific product names and prices from a certain category
Scenario: You need a list of product names and their prices for all products belonging to the "Electronics" category, where the price is greater than $100.
Inputs:
- Database connection: (Same as Example 1, but connecting to a
product_catalogdatabase)- Type:
MSSQL - Server:
productdb.example.com - Database:
product_catalog - User:
product_admin - Password:
another_secure_pass - Port:
1433
- Type:
- Table:
Products - Data format:
Product_Schema(defines columns likeProductID,ProductName,Category,Price,Stock) - Filters:
- Filter 1:
- Attribute:
Category - Operator:
Equal - Value:
Electronics
- Attribute:
- Filter 2:
- Attribute:
Price - Operator:
Greater than - Value:
100
- Attribute:
- Filter 1:
- Attributes:
ProductName,Price
Result: The QUERY_RESULT variable will contain a list of products, each entry showing only the ProductName and Price, for all products in the 'Electronics' category that cost more than $100.
Example 3: Finding users registered within a specific date range
Scenario: You want to find all users who registered on your platform between January 1st, 2023, and March 31st, 2023, and only need their email addresses.
Inputs:
- Database connection: (Same as Example 1, but connecting to a
user_managementdatabase)- Type:
MYSQL - Server:
userdb.example.com - Database:
user_management - User:
app_user - Password:
user_pass_secure - Port:
3306
- Type:
- Table:
Users - Data format:
User_Schema(defines columns likeUserID,Email,RegistrationDate,LastLogin) - Filters:
- Filter 1:
- Attribute:
RegistrationDate - Operator:
Greater than or equal - Value:
2023-01-01
- Attribute:
- Filter 2:
- Attribute:
RegistrationDate - Operator:
Less than or equal - Value:
2023-03-31
- Attribute:
- Filter 1:
- Attributes:
Email
Result: The QUERY_RESULT variable will contain a list of email addresses for all users who registered between January 1st, 2023, and March 31st, 2023.