Forum Discussion
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 😔
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 )
- rashmi4 years agoNew Contributor III
hi @alchemiz thanks for helping but thats not exact requirement actually there are two arrays in input called row and group
and each looks like this as shown below
so according to position values (rowid & colid) need to update values of second array (group array)only
expected output: