I have a table that displays a player name. I now want to show the Team it belongs to.
My challenge is that the Player’s name comes from a collection called “RSVP” and the team calls from the collection “Players”
I have tried many things (creating function calls, manually doing and no success). The link below seems to do very close what I need but it only give me those that matches.
Is there a better approach?
Goal:
Show a table like this:
Player Name Team
john doe horn
jane doe honey
gia jade honey
Please provide more details: what is the reference filed that connects the collections? how do you bind the data to the table (I guess when you said ‘table’ you meant a table UI element on the webpage. Right?)?
Hey JD! Thank you so much you are the best!!
I would had never thought about taking that approach.
It works perfectly. Now I have another thing to do and that is to show the ones that did not have a team assigned, since the logic you sent me only show those having a team.
//In green are the lines that are already in you code, do not copy them again:
$w('#tblEventList').rows = rowsArr;
const teamlessPlayers = items.filter(e => !rowsArr.some(p => p.player === e.playerName));
const counter= rowsArr.length + 1;
const teamlessRows = teamlessPlayers.map((e, i) => ({OrderId: counter + i, player: e.playerName}));
$w('#teamlessTable').rows = teamlessRows;
})
//...