Forum Discussion
Hi @Tanmay_Sarkar - this is a complex requirement. There are ways to have SnapLogic create multiple documents from a single document, but here you have multiple documents that need to first be analyzed and summarized to determine the total value, then split the “overflow” values into multiple documents. My recommendation is that you look into the Script snap and use the language of your choice (Javascript, Python, Ruby) to do this.
- jfpelletier2 years agoContributor
Hello SpiroTaleski,
Thanks very much for your reply! It works for a simple case, however I realized that my use case might be a bit more complex. Here's with a bit more details...
In the initial JSON that I'm getting from the HTTP Client call, which is an array of JSON objects, I have to keep and use at least two elements from the initial response. The array contains JSON objects that describe a project, including values such as the project name, it's ID, and other elements that I might need at some point. It does not however contain the JSON with the potential "file" key that I also need, I have to do another call for that, using the "id" that I got from the first call.
Please have a look at the illustration below. It shows the process where I need to first get the project name and ID of each project on a server, then using the value of the ID I need to make another call to get the file name(s) and path(s) if they exist. If there is no file in the project, then no action is required.
I think that I would need to use a "join" snap to create a new JSON as new payload for the next call, with a condition (set by the router) that would consider only when the "file" element exists, correct? Or is there a better way?
Thanks a lot again!
JF