Suppose I'm creating a Christmas list and tracking the gifts I am getting for people using org-tables
. I have a named table for each group of people I am getting gifts for. These tables contains product & price info. I also have a summary table that gathers the totals for each table and puts them in their own table with a final total.
Is there a way that I can recalculate the summary table and it will go through each named table and perform a recalculation of each sub-group?
Below is a reproducible example of what I am talking about:
#+TBLNAME: Summary
| ! | Group | Total |
|---+----------+-------|
| # | Kids | 208 |
| # | Spouse | 350 |
| # | Parents | 155 |
| # | Siblings | 205 |
|---+----------+-------|
| # | Total: | 918 |
| ^ | | tot |
#+TBLFM: $3=remote($Group,$tot)::$tot=vsum(@-I..@-II)
#+TBLNAME: Kids
| | Product | Price |
|---+------------+-------|
| | Video Game | 60 |
| | Doll House | 38 |
| | Skateboard | 60 |
| | Books | 50 |
|---+------------+-------|
| | Total: | 208 |
| ^ | | tot |
#+TBLFM: $tot=vsum(@-I..@-II)
#+TBLNAME: Spouse
| | Product | Price |
|---+---------+-------|
| | Jewlery | 120 |
| | Clothes | 60 |
| | Pottery | 80 |
| | Books | 90 |
|---+---------+-------|
| | Total: | 350 |
| ^ | | tot |
#+TBLFM: $tot=vsum(@-I..@-II)
#+TBLNAME: Parents
| | Product | Price |
|---+---------------+-------|
| | Picture Frame | 45 |
| | Books | 50 |
| | Records | 60 |
|---+---------------+-------|
| | Total: | 155 |
| ^ | | tot |
#+TBLFM: $tot=vsum(@-I..@-II)
#+TBLNAME: Siblings
| | Product | Price |
|---+----------------+-------|
| | Sewing Machine | 145 |
| | Flannel | 60 |
|---+----------------+-------|
| | Total: | 205 |
| ^ | | tot |
#+TBLFM: $tot=vsum(@-I..@-II)
I don't mind have to perform the recalculation for each row in the summary table, but suppose I edit the Kids
table. If I don't manually recalculate the Kids
table, the Summary
table will not update either.
org-table-recalculate-buffer-tables
perhaps? Not sure in what order it does them though, so you might want to change the order of the tables so that the summary table is done last.C-c C-c
on theTBLFM
line of the summary table to update it.TBLNAME
is obsolete: it's now plainNAME
(although the old form is still recognized - probably).org-table-iterate-buffer-tables
instead: that should allow you to keep the summary table anywhere you want and still update it properly, although that's potentially more expensive than recalculating.