emacs-orgmode
[Top][All Lists]

Re: [O] How to apply multiple TBLFM rules?

 From: Michael Hannon Subject: Re: [O] How to apply multiple TBLFM rules? Date: Tue, 8 May 2012 13:21:54 -0700 (PDT)

```Bastien <address@hidden> wrote:

>
>> Perhaps only one #+TBLFM: per table is allowed
>
> More precisely, hitting C-c C-c on #+TBLFM: will just apply formulas in
> *this* line.
>
> Using several #+TBLFM: lines is sometimes useful when you want to apply
> different sets of formulas -- which I think is the use for #+TBLFM: in
> Michael's document (but I agree this is confusing there.)

Hi, Bastien.  Thanks for looking into this.  Let me start by saying that I'm
completely satisfied with the mechanism of joining formulas with the "::"
notation, and especially with the convenient editing of such formulas with
"C-c '".

But if the multiple TBLFM lines work as I think you're describing, then I
still have some gap in my understanding.

Here's my simple test table, with multiple formulas, joined by "::":

#+TBLNAME: test1
| 1 | 2 |   |
| 4 | 5 |   |
| 7 | 8 | 9 |
#+TBLFM: @1\$3='(+ 10 7)::@2\$3='(+ 11 9)::@3\$1=42

If I hit C-c C-c while the point is on the one and only TBLFM line, I get:

#+TBLNAME: test1
|  1 | 2 | 17 |
|  4 | 5 | 20 |
| 42 | 8 |  9

I.e.,exactly the intended result.

Here is the same table, but with the formulas spread across three different
lines:

#+TBLNAME: test2
| 1 | 2 |   |
| 4 | 5 |   |
| 7 | 8 | 9 |
#+TBLFM: @1\$3='(+ 10 7)
#+TBLFM: @2\$3='(+ 11 9)
#+TBLFM: @3\$1=42

If I hit C-c C-c while the point is on the FIRST TBLFM line, I get:

#+TBLNAME: test2
| 1 | 2 | 17 |
| 4 | 5 |    |
| 7 | 8 |  9 |

This is what I expected.  If I now proceed to hit C-c C-c while the point is
on the SECOND TBLFM line, I get:

#+TBLNAME: test2
| 1 | 2 | 17 |
| 4 | 5 |    |
| 7 | 8 |  9 |

I.e., there is no change whatsoever.  If I then hit C-c C-c while the point is
on the THIRD TBLFM line, I get:

#+TBLNAME: test2
| 1 | 2 | 17 |
| 4 | 5 |    |
| 7 | 8 |  9 |

I.e., again there is no change whatsoever.

I might add that if I do carry out these operations with table debugging
turned on (C-c {), I do NOT get prompted by the debugger when trying to
process the second and third TBLFM lines.

As I said above, I'm happy with the "::" solution and am happy to let this
topic drop, but I'm eager to expand my Org-mode skills.  Please let me know
what I'm missing.

Thanks again.

-- Mike

```