Hi Coda Community,
I’ve taught myself a lot of things about Coda and formulas from things I’ve seen posted here. I’m trying to do something that I’m not sure can be done ![]()
My friends and I play Blood on the Clocktower (BOTC) via asynchronous Discord chat. I’m working on this multi-page doc to help those of us who want to run games easily see information in various views to help them be effective storytellers.
The problem I’m currently running into is being able to correctly identify a player’s nearest neighbors, accounting for whether players are alive or dead. Because BOTC is played in a circle, Player 1’s neighbor “to the left” (Above Neighbor in my table) would be “Player 14” and the player “to the right” (Below Neighbor in my table) would be Player 2. But if Player 1 dies, I can’t figure out how to get my formulas to essentially skip over Player 1 - and thus say that Player 2’s left neighbor is now Player 14 instead of Player 1.
Here is how I’ve set it up:
Seat is calculated with this formula:
rank([thisRow.Rank],[thisTable.Rank].ToNumber()
I cobbled together these formulas from reading other forums for Above Neighbor and Below Neighbor.
Above Neighbor formula:
SwitchIf(
thisRow.[Seat #] = 0,
thisTable
.Filter(
[Seat #] < thisRow.[Seat #] + varPlayerCount
)
.Sort(
true, thisTable.[Seat #]
)
.Last(),
thisRow.[Seat #] = 1,
thisTable
.Filter(
[Seat #] < thisRow.[Seat #] + varPlayerCount
)
.Sort(
true, thisTable.[Seat #]
)
.Last(),
thisRow.[Seat #] >= 1 AND thisRow.[Seat #] <= varPlayerCount,
thisTable.Filter([Seat #] < thisRow.[Seat #])
.Sort(
true, thisTable.[Seat #]
)
.Last()
)
Below neighbor formula:
SwitchIf(
thisRow.[Seat #] = 0,
thisTable.Filter([Seat #] > thisRow.[Seat #])
.Sort(
true, thisTable.[Seat #]
)
.first(),
thisRow.[Seat #] = 1,
thisTable.Filter([Seat #] > thisRow.[Seat #])
.Sort(
true, thisTable.[Seat #]
)
.first(),
thisRow.[Seat #] > 1 AND thisRow.[Seat #] < varPlayerCount,
thisTable.Filter([Seat #] > thisRow.[Seat #])
.Sort(
true, thisTable.[Seat #]
)
.first(),
thisRow.[Seat #] = varPlayerCount,
thisTable
.Filter(
[Seat #] > thisRow.[Seat #] - varPlayerCount
)
.Sort(
true, thisTable.[Seat #]
)
.first()
)
I previously had the seat formula include that if the player wasn’t marked as “alive,” then the seat number would become 0. But that’s where I hit a dead end, because it broke my above/below neighbor formulas.
Would love anyone’s help to solve this or come up with something better!


