You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/variables/index.md
+90-15Lines changed: 90 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,38 +17,49 @@ They can be used in most Build configuration and input fields that take inputs o
17
17
- integer parameters (any integer),
18
18
- and boolean values (`true`/`false`).
19
19
20
-
Two kinds of variables can be defined:
20
+
Variables are organized in scopes.
21
+
Each scope is addressed by a prefix that is used when referencing a variable in a template, e.g. a project variable named `host` is referenced as `{{project.host}}`.
22
+
The following scopes are available:
21
23
22
-
`Global variables`
24
+
`Global variables` (`global.`)
23
25
24
-
: It is defined by the administrator in the configuration file at deployment time and cannot be set by a normal user.
26
+
: They are defined by the administrator in the configuration file at deployment time and cannot be set by a normal user.
25
27
26
-
`Project variables (User-defined)`
28
+
`Project variables (User-defined)` (`project.`)
27
29
28
-
: It is defined by the user in the UI.
29
-
Project variables can only be used in the same project.
30
-
If a project is exported those will be exported as well.
30
+
: They are defined by the user in the UI.
31
+
Project variables can only be used in the same project.
32
+
If a project is exported those will be exported as well.
33
+
34
+
`Task variables (User-defined)` (`task.`)
35
+
36
+
: They are defined by the user on an individual task and can only be used within that same task.
37
+
Task variables can reference global and project variables in their templates.
38
+
39
+
`Execution variables` (`execution.`)
40
+
41
+
: They are not defined statically but provided for a single workflow run, either when the workflow execution is triggered or while the workflow is running.
31
42
32
43
Build variables can be particularly useful in scenarios where multiple tasks or components within a system need access to the same data or configuration values.
33
44
Instead of repeating the same information in multiple places, project variables provide a centralized and reusable way to store and retrieve these values.
34
45
35
46
## Benefits of using variables
36
47
37
48
1. When sending an email to all employees, instead of manually typing or copy pasting each email address, you can conveniently store all the email addresses once and utilize them with a single word.
38
-
This saves time and ensures that no email addresses are missed or incorrectly entered.
49
+
This saves time and ensures that no email addresses are missed or incorrectly entered.
39
50
40
51
2. Another scenario where variables can be beneficial is when dealing with lengthy or hard-to-remember values.
41
-
For instance, consider the value "xmhnjnnjkmnlbbhbvfhnbjkm".
42
-
By assigning it to a variable, you can store it once and easily recall it whenever needed.
43
-
This avoids the need to repeatedly type or remember complex values, enhancing efficiency and accuracy in documentation and other tasks.
52
+
For instance, consider the value "xmhnjnnjkmnlbbhbvfhnbjkm".
53
+
By assigning it to a variable, you can store it once and easily recall it whenever needed.
54
+
This avoids the need to repeatedly type or remember complex values, enhancing efficiency and accuracy in documentation and other tasks.
44
55
45
56
3. In software development, when working with URLs or file paths that are long or subject to change, you can store them in variables.
46
-
This allows for easy modification and reuse throughout the codebase, reducing the chances of errors and making maintenance more efficient.
47
-
For example, you can assign a URL like "<https://example.com/api/data>" to a variable named `apiURL` for consistent referencing.
57
+
This allows for easy modification and reuse throughout the codebase, reducing the chances of errors and making maintenance more efficient.
58
+
For example, you can assign a URL like "<https://example.com/api/data>" to a variable named `apiURL` for consistent referencing.
48
59
49
60
4. When creating templates or form letters, variables can be used to personalize the content.
50
-
For instance, you can include variables such as {firstName}, {lastName}, and {companyName} to dynamically populate the recipient's name and company information.
51
-
This way, you can generate customized communications quickly without manually editing each instance.
61
+
For instance, you can include variables such as {firstName}, {lastName}, and {companyName} to dynamically populate the recipient's name and company information.
62
+
This way, you can generate customized communications quickly without manually editing each instance.
52
63
53
64
5. You can save the message, port, host or IP address, tokens, passwords, properties etc.
54
65
@@ -133,6 +144,70 @@ Type name as `email_ids`, in values we have updated all the email id’s of the
133
144
134
145
{ class="bordered" }
135
146
147
+
## Task Variables
148
+
149
+
While project variables are shared across all tasks of a project, task variables are defined on a single task and are only available within that same task.
150
+
They are useful for values that are specific to one task and should not leak into the rest of the project.
151
+
152
+
Task variables are managed in the same way as project variables, but from the configuration view of an individual task.
153
+
Open a task (for example a dataset, transformation or workflow) and locate the **Task variables** widget.
154
+
Click on :eccenca-item-add-artefact: to add a variable and provide a name, value and description in the same dialog used for project variables.
155
+
156
+
!!! note
157
+
158
+
The naming rules for task variables are the same as for project variables (letters, digits and underscores, not starting with a digit).
159
+
160
+
Task variables are referenced with the `task.` prefix, for example `{{task.myVariable}}`.
161
+
In their templates they may themselves reference global and project variables, so a task variable can be composed from project-wide values.
162
+
163
+
!!! note
164
+
165
+
Task variables are stored together with the task.
166
+
When the task or its project is exported, the task variables are exported as well.
167
+
They are not visible to or usable by other tasks.
168
+
169
+
## Execution Variables
170
+
171
+
Execution variables are not defined statically in advance.
172
+
Instead, they are provided for a single workflow run and are available to all tasks of that workflow during the run.
173
+
They are referenced with the `execution.` prefix, for example `{{execution.myVariable}}`.
174
+
175
+
!!! note "Execution scope fallback"
176
+
177
+
When a template references `{{execution.<name>}}` but `<name>` has not been set directly in the execution scope, the value falls back to the variable of the same name in the `task`, then `project`, then `global` scope .
178
+
A value that is set directly in the execution scope (provided when starting the workflow, or written during workflow execution) always takes precedence and suppresses the fallback.
179
+
If the name is not defined in any of the execution, task, project or global scopes, the reference remains unbound and template evaluation fails.
180
+
181
+
This makes execution variables convenient as overridable defaults: a workflow can reference `{{execution.<name>}}` throughout, and unless a particular run overrides it, the value is taken from the task, project or global variable of the same name.
182
+
183
+
There are two ways to supply execution variables:
184
+
185
+
### Passing execution variables when starting a workflow
186
+
187
+
When a workflow execution is triggered via the REST API, execution variables can be provided in the JSON request body under the `workflowVariables` key as a simple name/value map.
188
+
For example, executing a workflow with a single execution variable `testVar`:
189
+
190
+
```json
191
+
{
192
+
"workflowVariables": {
193
+
"testVar": "World"
194
+
}
195
+
}
196
+
```
197
+
198
+
Each entry is added to the `execution` scope and can be referenced anywhere in the workflow as `{{execution.<name>}}`.
199
+
For instance, an operator configured with the template `{{value}} {{execution.testVar}}` would resolve `execution.testVar` to `World` for that run.
200
+
201
+
### Setting execution variables during a workflow run
202
+
203
+
Execution variables can also be created or updated while a workflow is running, using the **Set execution variable** transform operator (category *Variables*).
204
+
This operator writes the first value of its (single) input into the `execution` scope under the configured variable name and passes the input values through unchanged.
205
+
206
+
!!! note
207
+
208
+
The **Set execution variable** operator only has an effect while running inside a workflow execution.
209
+
Execution variables are scoped to a single workflow run; they are not persisted and are not shared between runs.
0 commit comments