Forum Discussion

pratiksha_patil's avatar
pratiksha_patil
New Contributor II
6 years ago

Is there way to create global variable?

Hi,

I want to create a global variable so that the same value is accessible anywhere in the pipeline.
In my case I get token from api and I need to pass same token to child pipeline which are executed sequentially.Below is screenshot of pipeline which shows child pipeline execution

Thanks,
Pratiksha

8 Replies

  • @chmurray88 - if you place the expression library in a specific project, then any pipeline in that project can use it. If you place it in the project space / shared folder, then any pipeline within the project space (across all projects) can use it. If you place the file in the root shared (above all project spaces), then any pipeline within the org could use it.

    When the expression file is migrated to other orgs, you could update the values specific to that org. For example, if you use the expression file to define SMTP properties for your Email snaps, those are probably fairly static; as opposed to AWS S3 buckets / directories that should be different between you dev/qa/prod orgs.

    • chmurray88's avatar
      chmurray88
      New Contributor II

      @koryknick - very cool. thanks for the tips. So this is essentially global variable support. We will give this a shot.

      Thanks!

      Chris

  • christwr's avatar
    christwr
    Contributor III

    Unfortunately no such thing as global variables.

    There are a few ways to accomplish what I think you’re looking for though:

    • You could have your value as a pipeline parameter. Have a first pipeline that gets your token, and then executes a second pipeline, passing the token as a pipeline parameter. Then that second pipeline will have access to the parameter (like a global variable) for all of his steps (calling other pipelines, etc.)

    • You can keep passing the token along from snap to snap. In your example, the pipeline execute snaps should have output documents with an “original” array containing the data that was passed in to the snap. if your token was part of that, you should be able to use a mapper to put the value back where you want it for the next downstream snaps, etc.

  • chmurray88's avatar
    chmurray88
    New Contributor II

    @dmiller - Are global variables supported yet? If not, do you know when they will be supported? We have lots of use cases for this.

    Thanks!

    Chris

  • dmiller's avatar
    dmiller
    Former Employee

    @chmurray88 This has not been implemented. Product Management would need to decide if this is to be implemented.

    • chmurray88's avatar
      chmurray88
      New Contributor II

      Thanks @dmiller for the follow up.

      I’d imagine several customers could use a global variable option. Most modern day DE tools have this option.

      If you could pass along the feedback, it would be much appreciated!

      Chris

    • chmurray88's avatar
      chmurray88
      New Contributor II

      @koryknick -

      Thanks for the reply. It looks like these are only good for an individual pipeline? That’s fine to start.

      Question is…say I want to have an email address(to) in the email sender snap be one value in one org(dev org), but when I migrate the pipeline to the next org(prod org), I need that email address to be different. If I’m understanding how the expression library works, it will get migrated with the pipeline, but the value won’t be changed while going between orgs. Right?

      If there is another way to solve for this, I’m all ears.

      Thanks!

      Chris