cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Is there a way to aggregate arrays from several objects in documents from the same source

stephenknilans
Contributor

I was asked to change a relatively complex pipeline in a few ways, and was trying to see if I coud do it without ANY scripting. I figured it might be possible, but I canโ€™t figure out how to do the aggregation without a script object. Is there a way?

I have a number of documents coming from a system that all have a number of objects representing information about a given email. There may be 1 object, or there could be 100. For all of the emails that are found on an object with a given URI, I can split the objects up, so they have the information I need, but they then have to be aggregated into an array containing all of that email information, but ONLY for that URI. Then I can send them through a mapper object I created to create the proper document to process this properly. Then if they want to add or remove fields, or filter somehow, or change the JSON it will be as simple as any other snaplogic mapping.

To be clear, I donโ€™t think splitting it would be hard, and I have a mapper to create the email object from the source coming in at that point, I just have to have a way to put that into an array that, in theory, could be hundreds of objects, so I can push it through the next object to create the document needed to do what they want. All objects with a given URI in the object that contains those objects would have to go into the same array.

My fallback choice is to create a script object that aggregates things internally, and then puts out the documents.

2 REPLIES 2

tstack
Former Employee

Have you tried using the Group By Fields snap?

I donโ€™t think I have. I have been distracted for a few weeks, but how to work on this a bit tomorrow and over the weekend . I guess I will get a chance. Thanks.