Basic string transformations not working
Hi Team, I observed that basic string transformations are not working, few of the scenarios have been listed below: Trimming spaces from the text Changing the text from uppercase to lowercase and vice-versa I have used both the mapper and conditional snap however haven’t found any luck to it. Examples for the above-listed scenario: (1) Text is Darsh and if I put the transformation to change this to uppercase, it should return DARSH however the end result remains as is (2) Text is " Darsh", after using trim(), trimLeft(), trimRight(), the expected result should be “Darsh” however the end result doesn’t change. Any help on this would be highly appreciated. Regards, DarshSolved3.3KViews0likes4CommentsHow To Generate Rank with Partitions
Hi I need to generate the rank for the below data where data should be partitioned by No and Date order by value and want to get the top 3 ranked categories for each No and each Month. Input : No Category Date Value Rank 1 Dog 01-01-2022 32 1 Rabbit 01-01-2022 95 1 Fish 01-02-2022 4 1 Ox 01-02-2022 23 2 Cat 01-01-2022 4 2 Mouse 01-01-2022 12 2 Woman 01-02-2022 66 2 Man 01-02-2022 56 3 Bird 01-01-2022 54 3 Bee 01-01-2022 43 3 Cow 01-02-2022 32 3 Pig 01-02-2022 89 Expected Output : No Category Date Value Rank 1 Rabbit 01-01-2022 95 1 1 Ox 01-02-2022 23 1 1 Dog 01-01-2022 32 2 1 Fish 01-02-2022 4 2 2 Mouse 01-01-2022 12 1 2 Woman 01-02-2022 66 1 2 Cat 01-01-2022 4 2 2 Man 01-02-2022 56 2 3 Bird 01-01-2022 54 1 3 Cow 01-02-2022 32 1 3 Bee 01-01-2022 43 2 3 Pig 01-02-2022 89 25.1KViews0likes5CommentsFlatten multilevel/nested JSON Objects and Arrays
Hello there, Is there a way to flatten a nested JSON (multiple objects inside objects/arrays) without using a Script Snap? Take this input for example: { "msg":"Hello, World", "num":1, "fruits":{ "apple":1, "orange":4, "inner2":{ "message":"found" }, "cars":[ "bmw", "audi", "dacia" ], "cars2":[ { "bmw":"something" }, { "audi":"else" } ] } } The output should look like this: { "msg": "Hello, World", "fruits.cars2.1.audi": "else", "fruits.orange": 4, "num": 1, "fruits.cars.1": "audi", "fruits.cars.0": "bmw", "fruits.apple": 1, "fruits.cars.2": "dacia", "fruits.inner2.message": "found", "fruits.cars2.0.bmw": "something" } So every key name is constructed from the inner objects/arrays of key names delimited with “.” in the case of objects. In the case of arrays, the key name should also have the index number of the current item. One way to do this is using the script snap using any available language. A function that loops through the root object and check the type of the current property. If it’s of type Object or array then I can call the function again. I’ve tried using expression libraries but with no luck. Any ideas?5.1KViews0likes4CommentsSnapLogic SDK - Accessing pipeline properties and parameters
Hi, I am writing a custom snap in which I would like to get the pipeline name, runtime id and few predefined path parameter. I do not want to capture these as snap level properties for user to configure. Could you please let me know how to evaluate a expression like “pipe.label” without defining them as pipeline properties? I stumbled across ExpressionUtil.compile(“pipe.uuid”); code which returns SnapLogicExpression object. But nor sure how to evaluate the expression, which seems to require additional paramters like ScopeStack and DataValueHanler. Could you please help if there is easy way to access pipeline properties or execute a expression in custom snap? Regars, SripathiSolved6.8KViews0likes4CommentsDate Epoch Example
An epoch date is either the number of seconds or milliseconds since 1 January 1970 00:00:00 UTC. UNIX and other applications use seconds, while JavaScript uses milliseconds. SnapLogic uses JavaScript as its scripting language, so the epoch date is internally stored as milliseconds since epoch. In the example below, we are passing in the date in seconds since epoch. 1 - Set a project parameter. In my example, I have “dateEpoch” set to 1472799302. 2 - Use the following formula in a mapper snap: Date.parse(Date.parse(1000*_dateEpoch).toString()).toLocaleDateTimeString(‘{“timeZone”:“America/Chicago”, “format”:“MM-dd-yyyy HH:mm:ss”}’) This returns a value of: 09-02-2016 01:55:02 Further examples: Date.parse(1000*_dateEpoch) = “2016-09-02T06:55:02.000 Etc/UTC” Date.parse(1000*_dateEpoch).toString() = “2016-09-02T06:55:02.000Z” date test epoch_2017_02_28.slp (4.6 KB)6.4KViews2likes1CommentUsing list of values in Filter snap
Hi Team, Is it possible to function a list of values in the filter snap? Let’s assume, I want to filter IDs whose values are 100, 110, 300, etc., how can I put this in Filter snap without using || function? I was planning to use $ID IN (100, 110, 300, etc.) but this one doesn’t seem to work so I have been using a conventional way as below: $ID == "100" || $ID =="110" || $ID =="300" Thanking in advance for your suggestions. Regards, DarshSolved9.1KViews0likes12CommentsHow to check list of string present Another Column
Hi, I have one requirement in this there is one API return list of values comma separated and Another column coming from Snowflake and I need to compare and generate a flag Note : order of strings are not fixed Example Column1: [‘STRING1’,‘STRING2’,‘STRING3’,‘STRING4’] Column2: [‘STRING1’,‘STRING2’,‘STRING3’,‘STRING4’]4.9KViews0likes5CommentsAWS S3 Connection failure
Hello, I am trying to connect to the AWS S3 bucket with the Access Key Id and Secret access key using the AWS S3 Account type in Snaplogic. But it fails to validate and throws an error Failed to validate account:Cause: Access Denied (Service: Amazon S3; Status Code: 403 Using the same credentials I am able to connect with AWS S3 Bucket using AWS CLI and in PostMan as well by selecting Authorization type as AWS Signature. Can someone please help to identify why it is failing to connect in Snaplogic only?3.5KViews1like2CommentsPivot Data from rows to columns with many possible values for pivot field
Convert this accountId region reporttype count 1 APAC L1 Feedback Report 2 1 APAC L2 Feedback Report 2 2 APAC L1 Feedback Report 6 2 APAC L2 Feedback Report 4 3 APAC L1 Feedback Report 17 3 APAC L2 Feedback Report 4 3 EU L3 Feedback Report 3 to below one accountId Region L1 Feedback Report L2 Feedback Report L3 Feedback Report 1 APAC 2 2 0 2 APAC 6 4 0 3 APAC 17 4 0 3 EU 0 0 3 Note : the report type can have many values so don’t need static way of mapping fields unique key here is accountid and region3.8KViews0likes4Comments