Forum Discussion
If my understanding is correct, this is the same situation, isn’t it ?
You just need to tweak the expression a little bit.
Hi @bojanvelevski yes but here id corresponding to row comes in an array so how can we change it accordingly?
i tried this way its not working pls could u help if am missing something or doing wrong pls
input.json (1.0 KB)
@bojanvelevski, @alchemiz please could u help 😔
- rashmi4 years agoNew Contributor III
Hi @bojanvelevski , @alchemiz if i try hardcoding the record 1 , record2 in the expression i am getting as expected but how can we dynamically loop across all record?
- alchemiz4 years agoContributor III
You’re trying to update the value from $row right?
$row.map(r=> r.mapValues((val,key)=> key == ‘col’ ? val.map(c=> c.mapValues((v,k)=> k == ‘$’ ? $group[r[‘@id’] - 1].values()[c[‘@id’] - 1] : v)) : val))
- rashmi4 years agoNew Contributor III
Hi @alchemiz its not my requirement actually i had listed my requirement above i am updating value obtained from row array to group array
- alchemiz4 years agoContributor III
$group.map((g,i)=> $row.find((a,b,c)=> a[‘@id’] == i + 1) instanceof Object ? g.mapValues((val,key)=> $row.find((a,b,c)=> a[‘@id’] == i + 1)[‘col’].find((x,y,z)=> x[‘@id’] == (key.charCodeAt(0) - 64)) instanceof Object ? $row.find((a,b,c)=> a[‘@id’] == i + 1)[‘col’].find((x,y,z)=> x[‘@id’] == (key.charCodeAt(0) - 64))[‘$’] : val ) : g )