10-22-2019 06:14 AM
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.
Solved! Go to Solution.
10-22-2019 01:57 PM
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)
10-22-2019 06:41 AM
You may want to use a Join Snap instead of the Union.
10-22-2019 07:10 AM
@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.
10-22-2019 10:23 AM
@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)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?
10-22-2019 01:57 PM
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)