Copy Row From Table to Table

I decided to setup a Workout Log through Coda by using a set of buttons to simply things and I’ve ran into a problem. So far I have made one Button that works by opening a form to fill out that picks up information from a different table. This works fine, but I also have already planned out workout schedules I follow. Now what I want to create is a single button that when pressed add a specific workout plan to the Log.

The example below showcases said function, now what I want to do in practice is take the table known as Workout Plan 1 and copy all the rows and columns from that table and paste them into Workout Log with a single click of a button while also adding in the current date in Workout Log under the column “Date”.

Is this possible and if it is, how the heck do I do it?

Hello @Lukecetion,

This is made easy by combining FormulaMap and AddOrModifyRows fomulas. If you review the code in the button in the example below, you will see that it takes your [Workout Plan 1] table, then iterates over it and adds each to the [Workout Log] table, thanks!

2 Likes

Thanks! That works wonders! I have one other question though. Say I want to copy something from Workout Plan 1 to Workout Log like before, but now instead of all rows I just want a specific row like Row 3 - Dumbbell Lunges added to the Log and nothing else but the data from that specific row. Would that be possible?

Edit: Should have clarified something. In this case I want a button in each row in (for example) Workout Plan 1 that copies the Row the button is in over to Workout Log minus the button.

1 Like

Absolutely - see the edits below to the same document from above. I added an additional table, [Workout Plan 2], that operates that way instead. Also, if you are going to use that method, you can change the button to instead just push all of the individual row buttons, as shown in the “Add All to Log” button, thanks!

3 Likes