Expressions with pipelines

we have a need here in which we want to upload expressions to pipeline dynamically.

Is there any API out there which can upload expressions file dynamically on pipelines ?

Can expressions files be loaded from file system ? currently, it cant support expression while we upload expression files.

Answers will be much appreciated here…


any response here ? awaiting for input here.

Please state your use case for using dynamic expression files and what it contains.

Currently you cannot refer expression files from external file systems.

The situation you will run into is while developing the pipeline, the expression functions/variables you are referring to need to be validated and unless they are available in SLDB, it will not be successful.

You can make the expression library file reference an expression but it still has to exist within SLDB.

You can try uploading as a first step before the pipeline using the expr library; to upload to SLDB from an external file system.

Hope you got it.

  1. Write expr library file to SLDB after reading from an external file system based on whatever logic
  2. use the expression on the pipeline edit properties to derive it based on some logic.

Try it out and let us know.

It wont help here if we are changing the expression on pipeline edit properties however our use case as follows -

We expect files from 200 financial entities, every one has its own rule to parse the file and it can be changed dynamically.A business user can manage the rules and change the rules, at the same time we can leverage the same set of rules when we add the new payer.

In our design, we are building the rules in the expression files but here we need some capability to add expressions dynamically on pipeline whenever business user changes the rules.

Hope it helps here…


The Expression Libraries feature might be useful in this case. Libraries are files that are loaded into a pipeline at startup and made available to all expression properties through the ‘lib’ variable. So, you can create an object with a bunch of arrow functions containing the expressions you need access to. For example, if you created a file named ‘demo.expr’, with the following content and imported it into a pipeline. You could square numbers by calling ‘lib.demo.square(2)’ in an expression property.

    square: x => x * x

If that doesn’t quite work for you, there is also the eval function, which you can use to evaluate an expression string that was created dynamically. You could imagine using it in a similar fashion where the content was loaded into a string, eval’d, and then the resulting functions would be available for use. The downside being that the functions would not be available in every expression property.

I am well verse with expression library features,please refer to my use case mentioned in previous answer.

Sorry, I guess I’m not clear on what the flow is in your scenario.

Is this the gap you are referring to? Are you wanting to dynamically determine the set of expression libraries to import? More specifically, are you wanting to change the number of libraries you want to import or dynamically determine the library to import? The former is not supported at the moment, the platform can only import a fixed number of libraries, you can’t import N extra libraries at invocation. The latter is supported, you can make the library path an expression and use pipeline parameters to choose which library to import. You can also “overlay” libraries, so you could have a library with a default set of expressions and then overlay a second library with more specific values for a particular business.

I was thinking you would have one library file and updating the expressions in that as the rules were changing.

Also, how are you invoking the pipeline? With a scheduled task?


I think there is a way to do it.

If you read the pipeline using the metadata snap (snaplogic read) you will see these properties in the settings of the pipeline.

so this is how you would try to do it. I have not tried it but it should work logically.

  1. Upload the expression file dynamically to SLDB using File Writer.
  2. Make the reference of the expression file an expression
  3. using snaplogic update, update the pipeline settings --> import to point to the correct expression library you want to use.
  4. after usage, you can delete the expression library reference of the file itself.

Hope that makes sesnse.

Do you have any example on it ? would be much more helpful here.

I can also try from my end and let you all know how that works.

Help much appreciated here

Thanks for your help…