Forum Discussion
@dmiller I am a little closer to solve my problem but to solve it I still have some issue.
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)
- j_angelevski4 years agoContributor III
Hi @MikeP,
After the CSV parser, are your headers with empty values like
""
? Or simply there’s no data after after the csv parser ?- MikeP4 years agoNew Contributor II
hi j.evegelvski, the files will always have header text values like “Emp_ID”, the rows after this will be empty. I cant identify if we have any data for this file situation - no data. My dev head is saying maybe a ‘row count’ property (if data in any rows) after header row filtered out, this would be handy, but doesn’t seem to exist. Then just check if this value > 0.
Addendum: After the CSV Parser snap, then the next snap is a straight mapper snap for the document ($) the output view is
Hence why I thought the expressions I mentioned initially would work.
- j_angelevski4 years agoContributor III
Hi @MikeP,
In that case your expression should work because
$.isEmpty()
should return true. Not sure why it doesn’t work for you, but you can also try with the following:$.values().length == 0
. Can you also share your settings in the router snap ?