Table of Contents |
---|
Inside a Pipeline you can declare a custom macro using the command macro
and reuse it by calling the command macro.run
.
...
Status | ||||
---|---|---|---|---|
|
Table of Contents |
---|
What is a Pipeline Macro?
A Pipeline Macro or just Macro in short is a single Pipeline Expression which can be declared inside an automation pipeline using the command macro and then reused at multiple places of the pipeline using the command macro.run. It is similar to a function / method definition and its call, but it is limited to the execution of a Pipeline Expression.
If you need to implement and reuse more sophisticated logic, consider to call a sub-pipeline by using the command pipeline.run instead.
Declaring a Macro​
Here is a simple example to declare a macro in a pipeline:
...
The parameter args
defines the (optional) parameters to the macro as name-value pairs.
This These arguments can be directly accessed by their names inside to the macro expression.
...
In order to call a macro from another position in the pipeline, you have to first declare it using the command macro and to define a name for the macro unique inside the pipelie using the parameter name
.
Info |
---|
|
...
As soon as such a macro has a name
assigned, it will no longer be executed by the default pipeline flow, but ignored. Now, it can only be executed only by calling the command macro.run
.
...
In case you do not define any args in macro.run
, the default args will be used. So, the output here would be:
...