I was taking a look at this and there are a couple things going here that show how powerful Coda can be, but also that it’s complex at times.
Your sequence formula to create the list to work from will generate a list of numbers instead of a list of rows.
Sequence(1, Movements.CountIf(Workout.Contains("A")), 1)
You can actually use a Filter()
formula here to filter your table and return the rows instead. Then the FormulaMap()
will run through the actions on the rows instead of on a number.
Movements.Filter(Workout.Contains("A"))
A trick I use here is simply adding this formula to it’s own column or in the canvas then see what it returns. You should get a list of row “capsules” that you can hover over and see all the row info.
Then in your FormulaMap and AddRow, anytime you’re referring to a value that you need from the current row being processed, you should use CurrentValue()
and anytime you need a value returned that is from that row only, you should use thisRow()
.
So the following…
[Workout History].Exercise, Movements.Exercises
Should be…
[Workout History].Exercise, CurrentValue.Exercises
The list of rows being run through the FormulaMap is already from the [Movements] table and it’s the current row being processed that we want the value for.
Give these tweaks a try and see if they help.