sdeng
7 years agoNew Contributor II
How to get the sequence for a group of values
Like how to get AddressNO group by the same IDs like below?
- 7 years ago
Oh, sorry for the misunderstanding. You want to generate the AddressNO based on the number of elements for each ID?
You’ll have to modify the sort and group by to do so by ID. Then afterwards you’ll need a Mapper snap using the map expression.
$group.map((e, index) => e.extend({'AddressNO': index + 1}))
For each element that was group, this will extend it with the index in the group array.
Finally now that the elements have an AddressNO you can split everything back out using the JSONSplitter snap.
I’ve updated the pipeline so you can try it out yourself.
groupby-example_2018_10_26.slp (8.0 KB)