* $LR syntax in tables
@ 2009-08-12 15:01 Andrew Stribblehill
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Stribblehill @ 2009-08-12 15:01 UTC (permalink / raw)
To: emacs-orgmode
I'm afraid I can't quite wrap my head around this puzzle. I have a little table:
| Budget | 640 | 640 |
| Some expense | -165 | 475 |
#+TBLFM: $3=$LR3+$2
So col C is supposed to add the previous line's col C to the current
line's col B.
However, it seems that $LR3 is referring to the _subsequent_ line not
the previous one. Is there a bug or just my misunderstanding?
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: $LR syntax in tables
[not found] <20090812160618.A958E30520@mailhost.cs.tu-berlin.de>
@ 2009-08-12 16:21 ` Stephan Schmitt
2009-08-12 16:39 ` Stephan Schmitt
0 siblings, 1 reply; 4+ messages in thread
From: Stephan Schmitt @ 2009-08-12 16:21 UTC (permalink / raw)
To: emacs-orgmode, Andrew Stribblehill
Andrew wrote:
> I'm afraid I can't quite wrap my head around this puzzle. I have a little table:
>
> | Budget | 640 | 640 |
> | Some expense | -165 | 475 |
> #+TBLFM: $3=$LR3+$2
>
> So col C is supposed to add the previous line's col C to the current
> line's col B.
>
> However, it seems that $LR3 is referring to the _subsequent_ line not
> the previous one. Is there a bug or just my misunderstanding?
>
> Thanks.
Hi Andrew,
what you need is this:
| | | 0 |
| Budget | 640 | 640 |
| Some expense | -165 | 475 |
#+TBLFM: $3=@-1+$2::@1$3=0
the LR-reference is for the last, that is, the bottom row.
You need the first row and the field formula for C1 in order to initialize the
cumulative sum properly.
hth,
Stephan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: $LR syntax in tables
2009-08-12 16:21 ` $LR syntax in tables Stephan Schmitt
@ 2009-08-12 16:39 ` Stephan Schmitt
2009-08-12 16:45 ` Stephan Schmitt
0 siblings, 1 reply; 4+ messages in thread
From: Stephan Schmitt @ 2009-08-12 16:39 UTC (permalink / raw)
To: emacs-orgmode, Andrew Stribblehill
Stephan wrote:
> Andrew wrote:
>> I'm afraid I can't quite wrap my head around this puzzle. I have a
>> little table:
>>
>> | Budget | 640 | 640 |
>> | Some expense | -165 | 475 |
>> #+TBLFM: $3=$LR3+$2
>>
>> So col C is supposed to add the previous line's col C to the current
>> line's col B.
>>
>> However, it seems that $LR3 is referring to the _subsequent_ line not
>> the previous one. Is there a bug or just my misunderstanding?
>>
>> Thanks.
>
> Hi Andrew,
>
> what you need is this:
>
> | | | 0 |
> | Budget | 640 | 640 |
> | Some expense | -165 | 475 |
> #+TBLFM: $3=@-1+$2::@1$3=0
>
> the LR-reference is for the last, that is, the bottom row.
>
> You need the first row and the field formula for C1 in order to
> initialize the cumulative sum properly.
>
> hth,
> Stephan
>
p.s.
another solution would be:
| Budget | 640 | 640 |
| Some expense | -165 | -165 |
#+TBLFM: $3=@-1+$2::@1$3=@1$2
Greetings,
Stephan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: $LR syntax in tables
2009-08-12 16:39 ` Stephan Schmitt
@ 2009-08-12 16:45 ` Stephan Schmitt
0 siblings, 0 replies; 4+ messages in thread
From: Stephan Schmitt @ 2009-08-12 16:45 UTC (permalink / raw)
To: emacs-orgmode, Andrew Stribblehill
Stephan wrote:
>
> Stephan wrote:
>> Andrew wrote:
>>> I'm afraid I can't quite wrap my head around this puzzle. I have a
>>> little table:
>>>
>>> | Budget | 640 | 640 |
>>> | Some expense | -165 | 475 |
>>> #+TBLFM: $3=$LR3+$2
>>>
>>> So col C is supposed to add the previous line's col C to the current
>>> line's col B.
>>>
>>> However, it seems that $LR3 is referring to the _subsequent_ line not
>>> the previous one. Is there a bug or just my misunderstanding?
>>>
>>> Thanks.
>>
>> Hi Andrew,
>>
>> what you need is this:
>>
>> | | | 0 |
>> | Budget | 640 | 640 |
>> | Some expense | -165 | 475 |
>> #+TBLFM: $3=@-1+$2::@1$3=0
>>
>> the LR-reference is for the last, that is, the bottom row.
>>
>> You need the first row and the field formula for C1 in order to
>> initialize the cumulative sum properly.
>>
>> hth,
>> Stephan
>>
>
> p.s.
> another solution would be:
>
> | Budget | 640 | 640 |
> | Some expense | -165 | -165 |
> #+TBLFM: $3=@-1+$2::@1$3=@1$2
>
> Greetings,
> Stephan
>
p.p.s.
forgot to say: you must evaluate the formulas twice (C-u C-u C-c C-*)
| Budget | 640 | 640 |
| Some expense | -165 | 475 |
#+TBLFM: $3=@-1+$2::@1$3=@1$2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-08-12 16:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20090812160618.A958E30520@mailhost.cs.tu-berlin.de>
2009-08-12 16:21 ` $LR syntax in tables Stephan Schmitt
2009-08-12 16:39 ` Stephan Schmitt
2009-08-12 16:45 ` Stephan Schmitt
2009-08-12 15:01 Andrew Stribblehill
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).