The solution within the topic you shared already uses Splice()
See the If()
within the quote above
I’ll admit that the whole solution within that topic seems a bit complicated to read, because of all the nested WithName()
(which are there to avoid some redundancy)… but I find it elegant .
Now, in a far less elegant way but maybe easier to grasp, here’s an action button also doing what was asked in the topic you shared … Which I’m just sharing trying to answer your question …
(You’ll find the sample below )
If(thisRow.Going.Not(),
ModifyRows( //Click 1: Add the player
Games.Filter(Date = nextGame),
Games.RSVPs,
ListCombine(
Games.RSVPs.Filter(CurrentValue.IsNotBlank()),
thisRow
)
),
ModifyRows( //CLICK 2: Remove the player
Games.Filter(Date = nextGame),
Games.RSVPs,
Games.Filter(Date = nextGame).First().RSVPs.WithName(CurrentList,
Splice(
CurrentList,
CurrentList.Find(thisRow),
1
)
)
)
)
In the “Click 2” action (the 2nd ModifyRows()
) there’s this bit of formula :
Games.Filter(Date = nextGame).First().RSVPs.WithName(CurrentList,
Splice(
CurrentList,
CurrentList.Find(thisRow),
1
)
)
And what it does is:
- It takes the table
Games
and look for the rows whereCurrentValue.Date
is equal to thenextGame
(the date on the canvas).
This actually returns a list of 1 row from the tableGames
. So, to effectively get the row from that list of 1 row, I’ve appendedFirst()
to theFilter()
. - Now that we have the appropriate row, we can access the values in the field
RSVPs
. (I.e.: the list of players) - As I’m going to need that list in
Splice()
and to avoid repeating theFilter()
, I’m storing the list within the named valueCurrentList
using WithName() - All that’s left to do is to
Splice()
theCurrentList
according to the position ofthisRow
(whichFind()
helps us retrieve) within theCurrentList
Splice( CurrentList, //Value CurrentList.Find(thisRow), //Start - (Where to begin to delete) 1 //deleteCount - How many to delete )
Now, I’m not saying this doesn’t require a bit of work though … But I hope this helps