Overview
You can use {tokens} anywhere in the source and destination queries, also anywhere where the user can enter SQL query.
How it works
The system will replace the {token} on the value of the Flow variable.
Setting values of the flow variables
Use one of the following methods to set values of the flow variables:
- Parameters passed as URL parameters or URL variables to the user-created API endpoints.
- Parameters passed as URL parameters to the run Flow by name API.
- Parameters passed as a payload to the run Flow by ID API.
- Parameters defined when creating nested Flows.
- Parameters passed as database loop parameters.
- Parameters passed as file loop parameters.
- Parameters set when executing flow manually.
- Parameters set when configuring the schedule.
- Parameters set when configuring the flow to be executed by Integration Agent.
In addition to Flow variables, the destination query can contain {source field names}.
Using SQL query results as parameters
In Etlworks, values returned by a SQL query can be used to parameterize other flows or queries.
This is commonly used when workflow behavior depends on configuration data stored in a database.
There are two common approaches:
- Database Loop – execute a flow once for each record returned by a query.
- Lookup a Value from a Script – retrieve a value from a query and reuse it in the workflow.
Option 1: Database Loop
A Database Loop executes a flow once for each record returned by a SQL query.
The query result becomes the driver of the loop. Each row in the result set creates a separate iteration, and the values from each column are automatically available as variables that can be referenced using {variable} syntax.
This approach is typically used when multiple records must be processed independently.
For full documentation, see:
Option 2: Lookup a Value from a Script
If you only need to retrieve a single value from a database query and reuse it later in the workflow, you can execute the query from a JavaScript or Python step using the lookup function.
The returned value can then be stored in workflow variables and referenced by other steps.
For details and examples, see: