I have a column “Win or Loss” that is a 0 or 1. It is the result of a formula in the Table. I would like to filter a result set to a certain number of rows in that table, which is working, and then sum the “Win or Loss” column. I figure this can be done with a reduce function. In this function which I call for each player, the goal is to calculate how many wins they have:
let myGames = query.records.filter(record=>record.getCellValueAsString("Player")==player)
let total_wins = myGames.reduce((total,record)=>total + record.getCellValue("Win or Loss"));
The output for total_wins ends up being something like this:
“Operator ‘+’ cannot be applied to types ‘Games_Players_RolesTable_Record’ and ‘number’.”
which explains why this is wierd, but I can’t figure out the right way to do it. Any pointers would be appreciated. Thank you!