Performing an Action when there is no data
A common integration pattern is to do something when no data is received. For example, we might read a file, parse it, and find that no records meet some filter criteria. As a result, we might send an email, or insert a ticket into a ticket management system like ServiceNOW. However, in SnapLogic, this can be somewhat more difficult than it seems initially because of the streaming architecture. In fact, many snaps will not execute without input documents - rather hard to accomplish when there is no document to flow through: So, how can we take an action, even though there’s no document to run the snap? The trick is to make a document and force it into the stream with a Join Snap (set to Merge): Note in this figure that even though nothing flows into the top view of the Join Snap, it still produces an output. This enables us to use the Router snap to check whether or not a field that we know will exist in the source does in fact exist. If it does, we know that data has passed through the Filter snap and then been merged with the Sequence data. If it does not, we know that only the Sequence data has been passed through and therefore nothing made it through the Filter . Only one of these views will have anything pass through it. The magic here is in the Merge option in the Join snap. As long as it is receiving data on a view, it will output - even if it has nothing to ‘join’ to. Meanwhile, the Sequence snap will always output the number of documents that you set it to. In this case, only one is required. (This pipeline here: Do something after no doc filter_2017_04_26.slp (11.1 KB) )14KViews7likes14Comments🔍 Join our Navigation Study and Help Shape SnapLogic's User Experience!
Hello SnapLogic Community! We’re conducting a study to improve navigation within SnapLogic, and we want your input! By sharing your valuable feedback, you’ll play a pivotal role in improving the user experience of SnapLogic. This is an unmoderated study and should take less than 10 minutes of your time. :memo: STUDY IS CLOSED Your insights matter to us, so don’t miss this opportunity to make a difference! Thank you, The SnapLogic Team3.3KViews6likes3CommentsExpression library for condensing Reltio REST API response
Before 2017 Winter Release, transforming a Reltio REST API response JSON object into a simple structure can be a tedious task. The expression library feature from 2017 Winter Release can make it much easier. Encouraged by @dmiller, am sharing a pipeline to showcase this technique. In this fictional scenario, the ask is that only output the Mobile phone fields. Attached: Community posting expression library for condensing Reltio REST API response_2017_04_12.slp (7.6 KB) reltio.expr.txt (136 Bytes) Fake_Reltio API response.json.txt (3.1 KB) Phone.json.txt (288 Bytes) How to test the example pipeline: download the pipeline file and reltio.expr.txt rename the reltio.expr.txt to reltio.expr upload the pipeline and reltio.expr to a project generate the previews Content of the expression library file: { ov: y => y.find(x => x.ov == true).value, findByType: (x,type) => x.find(y => this.ov(y.value.Type) == type && y.ov == true) } Pipeline property tab: Pipeline: First mapper: Second mapper: Condensed data from the output: [ { "uri": "entities/geFfGTn", "updatedTime": 1492024546326, "attributes": { "FirstName": "Gr", "LastName": "Moun", "Gender": "Male", "Phone": { "CountryCode": "+1", "Number": "9999990003", "Type": "Mobile" } } } ] The input Reltio API response JSON looked like this: [ { "uri": "entities/geFfGTn", "updatedTime": 1492024546326, "attributes": { "FirstName": [ { "type": "configuration/entityTypes/Individuals/attributes/FirstName", "ov": true, "value": "Gr", "uri": "entities/geFfGTn/attributes/FirstName/sv4pKXS0" } ], "LastName": [ { "type": "configuration/entityTypes/Individuals/attributes/LastName", "ov": true, "value": "Moun", "uri": "entities/geFfGTn/attributes/LastName/sv4pKfyW" } ], "Gender": [ { "type": "configuration/entityTypes/Individuals/attributes/Gender", "ov": true, "value": "Male", "lookupCode": "M", "lookupRawValue": "M", "uri": "entities/geFfGTn/attributes/Gender/19BWhlRa3" } ], "Phone": [ { "label": "Mobile 9999990003", "value": { "Type": [ { "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Type", "ov": true, "value": "Mobile", "uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd/Type/19BWhmKzP" } ], "Number": [ { "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Number", "ov": true, "value": "9999990003", "uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd/Number/19BWhmCSt" } ], "CountryCode": [ { "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/CountryCode", "ov": true, "value": "+1", "uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd/CountryCode/19BWhmGj9" } ] }, "ov": true, "uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd" }, { "label": "Home 5193217654", "value": { "Type": [ { "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Type", "ov": true, "value": "Home", "uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP/Type/zUqfhSxf" } ], "Number": [ { "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Number", "ov": true, "value": "5193217654", "uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP/Number/zUqfhXDv" } ], "CountryCode": [ { "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/CountryCode", "ov": true, "value": "+1", "uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP/CountryCode/zUqfhbUB" } ] }, "ov": true, "uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP" } ] } } ]3.7KViews5likes0CommentsWe Need You: Influence Our Next Big Thing
Hey there, I’m Jackie Curry, a new member of the user experience team at SnapLogic. We’re working on some exciting improvements to SnapLogic and I need your help to influence our upcoming products through user research. We’d like to show you some early concepts of what we’re working on to get your feedback and input. We want to know if these changes would help you do your job more efficiently. Plus, as a thank you, we’re offering a $100 gift card incentive to all participants who complete the study. If you’re interested, please email me at designresearch@snaplogic.com and I’ll set up a time to chat. Don’t worry, I promise to keep it brief! Thank you, Jackie – Jackie Curry Principal User Experience Designer jcurry@snaplogic.com2.4KViews5likes1CommentZip Writer S3 - base directory uses full S3 folder structure
I’m using a Zip Writer snap to add two files to a single .zip file. The files are located in a S3 bucket and are several directories “deep” in the S3 bucket folder structure (S3:///folder1/folder2/folder3/folder4/file.txt). I would like to add the two files to the base directory of the unzipped .zip file (/home/file1.txt, /home/file2.txt). The problem is that no matter what I put into the Base Directory option, I always get my complete S3 bucket folder structure when the .zip is unzipped (/folder1/folder2/folder3/folder4/file1.txt). Is there a way to put my files in the root of the unzipped file without the full S3 bucket folder structure?Solved4.8KViews1like4CommentsFind Array index from object value in the array object getindex?
I have a json file with an array designed like below. I don’t have control over the number of or order of address entries. I have tried $.Address.findIndex(x => x == ‘Home’) and $.Address ? (value.AddrType = Home) among other expression language statements. I would like to query the array by AddrType and get the index of the matching array entry record. Has anyone done something similar. We are attempting to normalize<<>>denormalize records based on types to denormalized fields that correspond to the types. {fnam:“Joe”,Lname:“Long”, Address:[ { “AddrType”: “Mailing”, “StreetAddr1”: “123 Prospect Street”, “City”: “Waltham”, “State”: “MA”, “Zipcode”: “” }, { “AddrType”: “Main”, “StreetAddr1”: “123 Baystate Street”, “City”: “”, “State”: “”, “Zipcode”: “”, } ]4.6KViews1like2CommentsSum of values in array of objects without reduce function
Hello all, I stumbled upon a situation where I have to find out a sum of a certain key in the objects residing in an array without reducing the objects? What I mean to say is, here is the input: [ { key1: value1, key2: 10 }, { key1: value2, key2: 20 }, { key1: value3, key2: 30 } ] The output that I am expecting should look like: [ { key1: value1, key2: 10, sum: 60 }, { key1: value2, key2: 20, sum: 60 }, { key1: value3, key2: 30, sum: 60 } ] The total sum of key 2 values should be pushed into each object as a new key. Can some one please suggest how to deal with this? Reducing won’t be the optimal solution as it would discard the objects and just add a new object with the total sum. Thanks.Solved8.9KViews1like7CommentsCan We create a Variable in Mapper
Hello Everyone, I am trying to create an incremental addition let say i have 2 columns empl_id and salary so in target i want to derive third column with cumulative salary. I can do it by using variable, have done it using Different tool but never implemented it in snaplogic Hence the question can we create Variable in mapper? any help is appreciated16KViews1like21CommentsAn XML Generator & XML Formatter Snaps example
Here’s an example illustrating the use case of the snaps XML Generator, XML formatter and File writer. The 1st snap “XML Generator” of the pipeline generates a document format data with the given xml input configured in the snap on “Edit XML *” in snap settings. The 2nd snap “XML Formatter” accepts the document format and encapsulates the data into XML formates and provides the the binary output which can be an input to the File writer snap which accepts the binary input. Attached is the .slp for pipeline reference.XMLGenerator_Formatter_2017_03_1.slp (4.1 KB)4.6KViews1like1CommentIs there a way to selectively exclude fields output from a mapper snap?
I have a case where many fields may have to be excluded from mapper output, as if they never existed, selectively during a run. I am going to a cloud instance of a routine that will take null values in, and display them, or may delete wanted values, if this is not implemented correctly. Is there some way of implementing a way to selectively disable/enable the “target path” declaration on a mapper, while it is running? I even tried passing all nulls, and it doesn’t work.