Recording a table state to a new table in separate rows?

Hey there Coda Community

New here but after a day of tinkering and hours of reading and watching tutorials I feel like I’m missing something. I’m trying to create a more robust workout tracker, that after filling out the sheet records the data into the ‘Logs’. Currently Coda puts the information as a list or array into a single cell, but I want each item or data point to be in it’s own cell. I’ve gotten around it for now by making everything a bulleted list so it’s a bit readable but doesn’t help in furthering the doc. Is there a better way to achieve this?

What I currently Have:

Thanks for looking! Any help is much appreciated.

Hey @Brian_Sander you’ve shared it but I can’t see any of the formulas to help … please change permissions.

Oops! Should be all good now @Johg_Ananda - thanks for taking a look!

Still is view only and I cant see any formulas.

Hi @Brian_Sander,

And welcome to the Coda Community!

At first glance, my thought is to just use a table and a view instead of the buttons and trying to carry over to a separate table. I had created a pay tracker that needed new values every day so I setup an automation to add the rows I needed with the date, then a view that only showed the rows equal to Today(). So I had a simple content entry view, then the main table on another page showed all the data.

Views are a very powerful part of Coda.

@BenLee That seems like a much nicer way to do things but the base problem I’m having is still persistent it seems.

Is it really so hard to: ‘Make X rows for number of X in table.column.Y’

Currently when I press the ‘test button’ in my History Page I get this:


What I want is this:

and I was only able to get a row for each item by finding this thread referencing Sequence()

It just isn’t making sense to me why this formula needs to be so complicated.

Once I have that button working to just get a single value instead of the entire list then We’ll be good and I can put it into the automation as you suggested so I won’t have to touch the thing again.

I think what you’re looking to do is extra work here and using views will take out the complexity. If you do need the entry table and the log table to be separate though, I would create a new column in the table where you enter your workout data and make it a “Button” type.

Then for that column button, I would use a formula like this…

RunActions(
AddRow([Workout History], 
  [Workout History].[Column 1], thisRow.Exercise, 
  [Workout History].[Column 2], thisRow.[Set 1], 
  [Workout History].[Column 3], thisRow.[Set 2]
),
DeleteRows(thisRow)
)

You’ll need to add the rest of your columns for the button to update, but this shows the idea.

This formula uses RunActions() which allows you to create a comma separated list of actions for a button to run. So it’s like pushing two buttons instead of one. The first action will add the row and whatever values you include to the new table. The second action will delete the current row. So you can transfer the row to your “Workout History”, then delete it from your entry table.

Then you can create a canvas button that simply pushes the column button. So it will push the button for each row in your table to move all rows over and delete them after they’re moved.

@BenLee , Thanks for the replies. Appreciate you taking a look.

I think you may be making an assumption though. What I’ve done is taken your suggestion of making a view of ‘workout history’ and making that the entry on the main page. What I’m currently doing is having a ‘test button’ before I turn it into the automated function so I can make sure it’s working correctly easier instead of clicking ‘test automation’ and stop and such.

This is my current formula that is adding the proper amount of rows (finally) the issue now is why am I getting a list of values, instead of just the value of the current row being iterated on in sequence.

Sequence(1, Movements.CountIf(Workout.Contains("A")), 1).FormulaMap(AddRow([Workout History], [Workout History].Date, Today(), [Workout History].Workout, "A", [Workout History].Exercise, Movements.Exercises))

I’m assuming I have to use something that gets the value of the row in question, I just don’t know what that something is whether it’s thisRow or currentValue or something. I’ve Updated the coda attached so you should be able to see what’s happening live. I’m no longer trying to move values entered from one table to another, I’m simply using a view that filters the date to today() as you suggested.

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.

1 Like

Thank you so much Ben! Your solutions not only worked perfectly, but allowed me to understand where I was going wrong.

I was always trying to do exercises.currentValue not realizing what the currentValue was referring to. Excellent explanations and thank you for such detailed replies. Appreciate your effort and patience!

1 Like