How to MAP item inside of MAP function
this may confusing. let me explain farther .
I give an example and maybe this is a problem for others and this formula help to boost your mapping process.
ex.1:i created app variables named pageVars.myList list of object with 2 property ids and names
example data/process:
data 1:
[
{
id: 1
},
{
id: 2
},
{
id: 3
},
{
id: 4
}
]
data 2:
[
{
id: 1,
name: "john"
},
{
id: 1,
name: "james"
},
{
id: 2,
name: "mark"
},
{
id: 4,
name: "tom"
},
]
This result i want
myList[
{
id: 1,
name: ["john", "james"]
},
{
id: 2,
name: ["james"]
},
{
id: 3,
name: []
},
{
id: 4,
name: ["tom"]
},
]
Now this is my Formula
pageVars.myList
actual formula
MAP(data 1, {id: item.id, names: MAP(SELECT(data 2, item.id==item.id), item.name )})
explanation
MAP(data 1, {id: item.id, names: MAP(SELECT(data 2, (item.id from data 2) == (item.id from data 1)), item.name )})
getting error sorting data 2 using item.id from data 1 inside of map function of data 2