10-13-2017 12:15 PM
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…
Thanks…
Rishi
12-21-2017 08:57 AM
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…
10-17-2017 09:20 AM
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.
10-17-2017 01:21 PM
I am well verse with expression library features,please refer to my use case mentioned in previous answer.
10-20-2017 10:12 AM
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?