cancel
Showing results for 
Search instead for 
Did you mean: 

Read expression library file from another Project

david_gaster
New Contributor

I’m writing a pipeline that uses Snap Metadata to validate strings in an expression library file. For this I would like to read the expression library file from a different project path. Is this possible?

A File reader has no way of parsing the .expr file…

Thanks

7 REPLIES 7

@david.gaster Got your requirement. Unfortunately you can’t pass library path from one pipeline to another but one work around I am thinking about is- in exp file path provide the full path of the expr file with Orgname, then it can be used. Provided you should have access on the project folder which contains the .exp . I have attached my pipeline, it might partially help you 🙂
my custom.exp file contains below expression.
{
removeAttributeFrmOject : (subObj,keyToRemove) => subObj.filter((value,key) => !key.contains(keyToRemove)),
}

readExpFromDiffFolder_2020_10_01.slp (4.9 KB) it might help you partially.

@Supratim Thanks for taking your time to try and help. 🙂 But unfortunately this isn’t the use case I’m trying to solve. It appears there may not be a solution to my use case

akidave
Employee
Employee

If the expression library file contains data, it can be written as a JSON file also. Instead of writing

{
    a: 1,
    b: 2
}

you could write

{
    "a": 1,
    "b": 2
}

The second format is valid JSON and the JSON parser snap will be able to read the expression library file. If the expression library has functions, then it will not be valid JSON. One workaround would be to separate data into one expression library file and functions into another file. The validation can be performed on the first file. The overlay feature can be used to combine the two files into one during the pipeline execution.