Problem with grouping objects

I have tree xml files. Each of the files contains the same section “Workers” and another section which doesn’t have to be in another file.

I would like to group it after common section and get situation in which specific Employee contain such tags which are in diffrent files.

To be precise, I have a situation as below

I have three records, and for employee “Adam Grey” I have two records - in one record there are data for TimeOffEventGroup column and for another record there are data for LeaveRequestEventGroup ,LeaveOfAbsenceEventGroup columns.

I would like to union these two records in such a way that for “Adam Grey” I have one record and there are data fill for each of these columns.

In the attachment I will send pipline. SnapLogic_Community_RU_2019_10_22.slp (34.5 KB)

Please suggest how to solve this issue.

You may want to use a Join Snap instead of the Union.

@dmiller It seems that I have to use firstly Union because I don’t know in which file I will have data for the same employee, maybe it happen in second and third files (additionally in this example there are 3 files but in the future there will be more files ).

Union and later using grouping seems correct approch but I have a problem with implement it.

@dmiller I am a little closer to solve my problem but to solve it I still have some issue.

SnapLogic_Community_2019_10_22.slp (28.7 KB)
So after mapper snap I use sorting snap and later grouping snap and the output from this snap it seems ok.In the last step I use mapper snap with expression “{}.extend(…$group)”.

The structure in output file is ok, but columns LeaveOfAbsenceEventGroup and LeaveRequestEventGroup are null for employee “Adam Grey” and I expected that in this case I also receive values. Could you explein me what I am doing wrong?

They are null because the second object in the group has null values for those properties, so it is overwriting the values from the first object in the group.

I would suggest moving Mapper2 in your example to the end of the pipeline and just work with the objects you already have. You can then use the merge() method to combine the objects in the group together. The merge will preserve the nested structure, so that the values of one object in the group don’t clobber the values in the other objects.

Here’s an updated version of your example:

GroupingObjects_2019_10_22.slp (28.2 KB)