Hello All,
Need some quick insights on below logic
Following I have set 1 and need to convert this in to expected output mentioned below
Set1 has name =A repeated thrice with different roles DO,EO,QI;so need an output A = DO,EO,QI
local!set1: { { "name": "A", "role": "DO" }, { "name": "A", "role": "EO" }, { "name": "A", "role": "QI" }, { "name": "B", "role": "IO" } }
Expected Output should be like below
----------------
{ { "name": "A", "role": "DO,EO,BI" }, { "name": "B", "role": "IO" } }
Discussion posts and replies are publicly visible
I will caveat this response by saying that there are likely many more elegant solutions to this question, however I've included my take on it below:
load( local!set1: { { "name": "A", "role": "DO" }, { "name": "A", "role": "EO" }, { "name": "A", "role": "QI" }, { "name": "B", "role": "IO" } }, a!foreach( union( local!set1.name, local!set1.name ), {"name":fv!item,"role":merge(local!set1[wherecontains(fv!item,touniformstring(local!set1.name))]).role} ) )