Read expression library file from another Project

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…


If you have access for that project you can upload /refer it from your pipeline. Click on upload option and select the project where you have .exp file.

After file read you can try parse it by json parser.


I think you have misunderstood my question. Let’s say you have a properties.expr file attached to a pipeline in a Project. For example, this is the path to the properties.expr file.

But I want to access this file from a pipeline in a different project that lives at /Org/DifferentProjectFolder/pipeline

Using a file reader to read the properties.expr file, it is not in JSON format, so a file reader to JSON parser will not work…

Refer here regarding expression library files: SnapLogic Documentation

@david.gaster Have you tried using ../../ProjectFolder/properties.expr?

Or you could move the file into shared folder.


No, my question isn’t about moving the file into the other project folder or referencing its path. Let me try to rephrase it.

Let’s say I have 50+ projects and I want to be able to dynamically read a properties file from one of those projects. Is there a way I can do that? I need to be able to actually access the functions from in those .expr files somehow.

It’s not feasible to move all 50+ files over as no one knows when they’d all be changing.

@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 :slight_smile:
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. :slightly_smiling_face: 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

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.

1 Like