- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2023 09:49 AM
I have data that looks like this:
I want to achieve the following result:
Please help!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2023 11:06 PM - edited ‎10-26-2023 11:43 PM
Hi @vgautam64 , I am unable to attached pipeline. so give you an example-
Data:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2023 12:46 AM
Hey @vgautam64,
Try the following expression:
$group.reduce((acc,curr,ind)=> acc.extend(curr.mapKeys((val,key)=>key+ind)),{})
Regards,
Bojan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2023 04:09 AM
Thank you @ddellsperger. The expression is not gross at all and it looks great. It looks like it could get me to the result but I honestly did not try it because I would prefer the keys to be in order since they have to be written as columns to an error report. I really appreciate your help though 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2023 11:06 PM - edited ‎10-26-2023 11:43 PM
Hi @vgautam64 , I am unable to attached pipeline. so give you an example-
Data:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2023 04:03 AM
Thanks @Supratim. This expression gets me to the desired result as well but I realized I don't need the Snaplogic's ensureArray function.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2023 12:46 AM
Hey @vgautam64,
Try the following expression:
$group.reduce((acc,curr,ind)=> acc.extend(curr.mapKeys((val,key)=>key+ind)),{})
Regards,
Bojan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2023 04:01 AM
Hi @bojanvelevski. This is such an elegant expression to achieve the task. I really appreciate the help. Thanks a lot!
