JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
Hector's Tips & Experiments
Welcome
Add rows from one table to another
Formula Map
In-line buttons
Random Formula
Accumulated Sum
Timer in a table
BUG: Gravity forms
More
Share
Explore
Add rows from one table to another
HR
Héctor Reyes
Goal:
Have a button that adds every row from “From” to table “To”
Thanks to Christiaan Huizer for this solution🙌
Add rows from table "from" to table "to"
From
From
Name
Category
Amount
Name
Category
Amount
1
Hector
Legal
10
2
Ana
Finance
5
3
Lucia
Legal
15
4
Other
Legal
1
5
then
Finance
1
6
Ana
Finance
1
7
c
Sales
1
There are no rows in this table
To
To
Name
Category
Amount
Name
Category
Amount
There are no rows in this table
How the formula works:
Sequence(1, From.Count())
// create virtual index
.FormulaMap(
/ iterate over each number in this index
To
.addrow( add row
[Table 2].Name,
From.Name.Nth(CurrentValue),
// take the list of values in the column and
put each item on the row corresponding
with number from virtual index
[Table 2].Category,
From.Category.Nth(CurrentValue),
[Table 2].Amount,
From.Amount.Nth(CurrentValue)
)
)
Categories
Categories
Category
Category
1
Finance
2
Legal
3
Sales
There are no rows in this table
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.