cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Flow context in Snaplogic Pipeline

harishankarkaim
New Contributor

In order to store a variable value which is accessible/modifiable by any snap in the pipeline, is there any capability within Snaplogic? The intention is to have a context which can hold shared variables accessible through out the execution of the pipeline.

2 REPLIES 2

stephenknilans
Contributor

Although you seem to ask for a global variable elsewhere, the only currently supported means to do this seems to be a โ€œpipeline parameterโ€(Which is like a constant you can set on the pipeline.). To create them/set their defaults, you have to go to the edit pipeline page:

image

The parameter is created as parameter, and used as _parameter, with the underscore prefix, as and where you would you it as a variable.

Unfortunately you CANโ€™T change them within a pipeline, and the only way to change the operation is to change the defaults, as I showed above, or set it in the pipeline by having ANOTHER pipeline set a variable and execute the desired pipeline with the values in the execute script snap.

Here is a pipeline I wrote to read a properties file for the environment, set the parameters, and kick off a process that propagates the parameters to every task before starting them in turn in the same manner:

image

The exit snap is to cause a fatal error if a fatal error happened in the task this runs.

BTW As a variable here, to set the parameters, I could have named them like $variable. But this was my first test in doing things at this level, and I just kept $_variable. ALSO, as you might expect, the parameters MUST be treated as EXPRESSIONS, as they are here with the variables. If the area you want to use them as parameters in does not allow expressions, you are out of luck there.

harishankarkaim
New Contributor

Thank you for the explanation.