Please see the attached example. If I call org-table-iterate-buffer-tables, Summary1 and Summary2 both are calculated using the referenced tables in heading "first set of tables" and the tables in the second heading are disregarded.

Without going into the details there are times when I use certain form tables in separate headlines in the same file. The entries are different in each and I believe that a function perhaps "org-table-iterate-subtree-tables" would be a useful addition to org-table.el.

Please note that narrowing the buffer to the second headline does not help since the code in org-table-iterate-buffer-tables widens the buffer.

Charlie Millar
* first set of tables

#+TBLNAME: SUMMARY1
| CHARGES        |      |       |
| Schedule "A"   | 6.00 |       |
| Schedule "A-1" | 6.00 |       |
| Schedule "A-2" | 6.00 |       |
| total          |      | 18.00 |
#+TBLFM: 
@>$>=vsum(@2$2..@4$2);%.2f::@2$2=remote(SCHEDA,@>$>);%.2f::@3$2=remote(SCHEDA1,@>$>);%.2f::@4$2=remote(SCHEDA2,@>$>);%.2f

#+TBLNAME: SCHEDA
| Description      | Basis |
|------------------+-------|
| Something A      |  1.00 |
| Something else A |  2.00 |
| Another thing A  |  3.00 |
| Total            |  6.00 |
#+TBLFM: @>$>=vsum(@I$>..@>>$>);%.2f

#+NAME: SCHEDA1
#+TBLNAME: SCHEDA
| Description        | Basis |
|--------------------+-------|
| Something A-1      |  1,00 |
| Something else A-1 |  2.00 |
| Another thing A-1  |  3.00 |
| Total              |  6.00 |
#+TBLFM: @>$>=vsum(@I$>..@>>$>);%.2f

#+NAME: SCHEDA2
#+TBLNAME: SCHEDA
| Description        | Basis |
|--------------------+-------|
| Something A-2      |  1.00 |
| Something else A-2 |  2.00 |
| Another thing A-2  |  3.00 |
| Total              |  6.00 |
#+TBLFM: @>$>=vsum(@I$>..@>>$>);%.2f


* second set of tables

#+TBLNAME: SUMMARY2
| CHARGES        |      |       |
| Schedule "A"   | 6.00 |       |
| Schedule "A-1" | 6.00 |       |
| Schedule "A-2" | 6.00 |       |
| total          |      | 18.00 |
#+TBLFM: 
@>$>=vsum(@2$2..@4$2);%.2f::@2$2=remote(SCHEDA,@>$>);%.2f::@3$2=remote(SCHEDA1,@>$>);%.2f::@4$2=remote(SCHEDA2,@>$>);%.2f

#+TBLNAME: SCHEDA
| Description      | Basis |
|------------------+-------|
| Something A      |  3.00 |
| Something else A |  2.00 |
| Another thing A  |  3.00 |
| Total            |  8.00 |
#+TBLFM: @>$>=vsum(@I$>..@>>$>);%.2f

#+NAME: SCHEDA1
#+TBLNAME: SCHEDA
| Description        | Basis |
|--------------------+-------|
| Something A-1      |  3.00 |
| Something else A-1 |  2.00 |
| Another thing A-1  |  3.00 |
| Total              |  8.00 |
#+TBLFM: @>$>=vsum(@I$>..@>>$>);%.2f

#+NAME: SCHEDA2
#+TBLNAME: SCHEDA
| Description        | Basis |
|--------------------+-------|
| Something A-2      |  3.00 |
| Something else A-2 |  2.00 |
| Another thing A-2  |  3.00 |
| Total              |  8.00 |
#+TBLFM: @>$>=vsum(@I$>..@>>$>);%.2f


Reply via email to