Enable editing of expression library file
When designing pipelines we have environment specific parameters (Dev, Test, Prod) in expression libraries. This renders our pipeline development independent of having to alter pipeline parameters or tasks between environments and deploys. However, the managing of the expression library files are a bit tedious. The file has to be downloaded, edited and uploaded again. It would be awesome to enable editing of the content of expression library file in the preview window. Example mockup: Of course having environment variables in a more accessible and standardised way would be the ideal solution, such as a new entity in SL manager, there could be an environment variables section in the projects as well as having the possibility to access shared env vars.3.4KViews1like3CommentsDynamically change the Delimiter in CSV parser
I’m designing ah pipeline that will handle multiple delimiters in a single CSV parser. I’m using a expression library that has the delimiter details of the respective files as below. [ { “src_file”: “aab”, “Delimit”: “PIPE”, “tgt_table”: “T_STG_AAB” } }, { “src_file”: “abc”, “Delimit”: “TAB”, “tgt_table”: “T_STG_ABC” } }, { “src_file”: “efg”, “Delimit”: “COMMA”, “tgt_table”: “T_STG_EFG” } } ] On the mapper snap I can write expression to refer this expression library lib.sample.find(x => x.src_file==“incoming_filename”).get(‘Delimit’). But when I try to use the same in CSV parser it doesnt accept. can we really do this.2.8KViews0likes2CommentsI am trying to perform a lookup and extend the object using the expression library
I wanted to perform a extend by performing a lookup using the expression library and it is giving me “this.comparator is undefined” error. Below is my expression Library Content: { embedbusinessUnit: x => x.extend({"Demo":this.comparator[0]}), embedbusinessUnit1: x => x.merge(this.comparator[0]), "comparator": [ { "KSCHL": "EPE", "VKORG": "1000", "BusinessType": "E", "KSCHLN": "LPE", "VKORGN": "1000" }, { "KSCHL": "EP0", "VKORG": "RG", "BusinessType": "N", "KSCHLN": "LP0", "VKORGN": "1000" } ] } When I access the lib.businessUnitExpr.embedbusinessUnit($) gives me a comparator undefined error. But when I access lib.businessUnitExpr.embedbusinessUnit1($) then it is able to identify the comparator Any help would be appreciated. BusinessUnitComparator.expr (382 Bytes)4.8KViews0likes5CommentsMongo DB Update Snap - Expression for Query
The following query works in MongoDB Atlas to update a record: db.mytable.update ( { _id : ObjectId(‘1234’) }, { $set : { “org_name” : “new org name” } } ) How do we configure this for use with the Mongo DB -Update snap? any one have an example?Solved2.3KViews0likes1CommentI have a use case where I have to invoke the one library function with another library function with in same expression library
I have created an expression library as below: { ‘DEPT’: { “EG” : “Engineering”, “HR” : “Human Resource”, “FIN” : “FInance” }, AddDescription : element => (element.filter(x=>x.sector==‘USA’).map(x=> x.extend({‘Description’:this.DEPT.get(x.deptId)})).filter(x=>x.get(‘Description’)!=null)) } Below is the expression I am using in mapper: lib.mapping_new.AddDescription($dept) The exception I am getting: Failure: this.DEPT is undefined., Reason: ‘DEPT’ was not found while evaluating the sub-expression ‘this.DEPT’, Resolution: Check the spelling of the property or, if the property is optional, use the get() method (e.g. this.get(‘DEPT’)) Check Expression_2022_03_23.slp (3.8 KB) For Ex: for the below input Array: { “dept”: [ {“deptId”: “HR”,“sector”: “USA”}, {“deptId”: “FIN”,“sector”: “USA”}, {“deptId”: “DE”,“sector”: “EU”}, {“deptId”: “EG”,“sector”: “USA”}, {“deptId”: “HR”,“sector”: “EU”}] } I want the below output: { “dept”: [{“deptId”: “HR”,“sector”: “USA”,“Description”: “Human Resource”}, {“deptId”: “FIN”,“sector”: “USA”,“Description”:“FInance”}, {“deptId”: “EG”,“sector”: “USA”,“Description”:“Engineering”}] } I know if we have two different libraries we can invoke one function from another, but I wanted to achieve this with a single expression library.Solved2.9KViews0likes2CommentsUsing expression libraries in JSON Generator
Hello, I need to generate a JSON with a bunch of dynamic keys, which are stored in an expression library. I haven’t found a well rounded solution so far, except pushing it all together in a single mapper field, however i was hoping to find something more graceful and readable. So my idea was to use a JSON Generator and piece together the information, however I run into two issues: How can I access the expression libraries in a JSON Generator? How can I set the values of the expression library as element key? I’ve tried several combinations to achieve the first thing: [ { "test" : $lib.env.jiraSyncDatefield[pipe.plexPath.split('/')[1]] } ] [ { "test" : ${lib.env.jiraSyncDatefield[pipe.plexPath.split('/')[1]]} } ] Once I have this working, the question arises on how i can set these values as element keys, I hope that will be working by enclosing them in square brackets. Did anyone have a similar task in the past? EDIT: Found a simpler approach, i wasn’t aware that the expression evaluation worked in the target path: Still, it would be good to know if the described use case is possible. Best regards Thomas1.6KViews0likes0CommentsExpression Library evaluates to ArrowFunction
Hello, i’m trying to nest a function in a map within an expression library, however what i get returned just the ‘callstack’ of the function. Here’s the outcome: [ { "test": "/* ArrowFunction @ line 5:10 */ () => __parent__.salesRegionMapper('accountableUnit', 8)" } ] The expression library is called like this: lib.map.responsibleUnit['8'] Here is the expression library: { "responsibleUnit": { "10": "Delivery", "9": "Operation", "8" : () => __parent__.salesRegionMapper('accountableUnit', 8), "16": "Tolling Services" }, "accountableUnit": [ [5, "Sales APAC"], [7, "Sales EMENA"], [8, "Sales EMENA"], [19, "Sales LAM"], [20, "Sales NAM"], [21, "Sales Africa"], [22, "Sales EMENA"], [23, "Other"], [24, "Sales EMENA"], [37, "Tolling Services"], [39, "Other"] ], salesRegionMapper: (mappingTable, value) => this[mappingTable].find(x => x[0] == value)[1], } How can i get the function to actually execute and not just be ‘listed’? Best regards ThomasSolved4KViews0likes5CommentsDynamic expression library path
I have a requirement where I need a path to a parameter within a expression library. I have a number of grouped collections, which have the same parameter name, something like this: "Search": { "Material": { "serverIPAdrress": "198.168.0.25", "localId": "1d524a85-7f01-4341-a923-0cc706478562" }, "Price": { "serverIPAdrress": "198.168.0.202", "localId": "b99d7b0e-5d13-4394-bffc-7951df46c292" }, "Customer": { "serverIPAdrress": "198.168.2.131", "localId": "98f0c2a3-d96a-400d-b48b-7b4f8752dc4e" } } I would like to use the Price or Customer, which I have as a input value ($original.searchType) in my mapper, within my expression library path e.g.: lib.config.Environment[pipe.projectPath.split('/')[1]].Search.$original.searchType.localId is there a way to include this in my mapping table, to dynamically allow to pass in generic parameters to the next snap? Thank you Jay2.3KViews0likes2CommentsReferencing snap, pipe variables from within an expression library
I’m trying to create an expression library function that needs access to both the snap and pipe variables. Can these variables be accessed directly from within the expression library function or must they be passed in as parameters? Right now my function looks like this: getHeader: (name) => match(pipe.flags.immediate_mode) { true => snap.original.load().get(name), _ => pipe.get("args",{}).get(name) } When I run this pipeline, I get the following error: {"error":"snap is undefined. Perhaps you meant: isNaN, jsonPath, JSON, String, _personsURL, parseInt","reason":null,"resolution":"Check the spelling of the variable"}2.2KViews0likes1CommentExpression Library - Environment Variable
Hi all, We are looking at building a solution for loading variables into pipelines via the expression library feature. One feature we would like to include is when loading the external library it will select the file based on the environment(ORG) that it is in. we have seen a method of doing this via the pipeline path.plexpath (Expression language) however this would involve a large query to select the path e.g.(…SLDev\Shared\Tools) Just wondering how other customers may have implemented this kind of solution in order to get environment variables. many thanks, Kiran