emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* problems with table mode
@ 2008-04-20 19:32 Pete Phillips
  2008-04-20 20:27 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Pete Phillips @ 2008-04-20 19:32 UTC (permalink / raw)
  To: org-mode mailing list

I am having a problem with a table I use to calculate my annual leave


| Basic Entitlement |         33 |
| Carryover         |          5 |
|-------------------+------------|
| Date              | No of days |
|-------------------+------------|
| 25th April        |          1 |
| 26th - 28th May   |          3 |
|-------------------+------------|
| Used              |          4 |
| Remaining         |          4 |
#+TBLFM: @III+1$2=vsum(@II+1$2..@III-1$2)::@III+2$2=@1$2+@2$2-@III+1

The table gives me the correct calculation for 'Used' - i.e., the number
of days I have taken so far.

However, the formula for the 'Remaining' row gives me the error 

  org-table-get-stored-formulas: Double definition `$2=' in TBLFM line, please fix by hand 

I don't understand this - if @III+1$w works for the second column in the
Used row, why doesn't @III+2$2 work for the second column in the
Remaining row ?

Any help appreciated.

Regards
Pete

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problems with table mode
  2008-04-20 19:32 problems with table mode Pete Phillips
@ 2008-04-20 20:27 ` Carsten Dominik
       [not found]   ` <18940.1208723747@localhost>
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2008-04-20 20:27 UTC (permalink / raw)
  To: pete; +Cc: org-mode mailing list

Hi Pete,

constructs like @III+1$2 are not allowed on the left side of a formula.
The left side must be either $N for a column, or @M$N for a field.
The error message stems from the face that the scanner for formulas
ignores the @III... spec and reads both formulas as $2=....

- Carsten

On Apr 20, 2008, at 9:32 PM, Pete Phillips wrote:

> I am having a problem with a table I use to calculate my annual leave
>
>
> | Basic Entitlement |         33 |
> | Carryover         |          5 |
> |-------------------+------------|
> | Date              | No of days |
> |-------------------+------------|
> | 25th April        |          1 |
> | 26th - 28th May   |          3 |
> |-------------------+------------|
> | Used              |          4 |
> | Remaining         |          4 |
> #+TBLFM: @III+1$2=vsum(@II+1$2..@III-1$2)::@III+2$2=@1$2+@2$2-@III+1
>
> The table gives me the correct calculation for 'Used' - i.e., the  
> number
> of days I have taken so far.
>
> However, the formula for the 'Remaining' row gives me the error
>
>  org-table-get-stored-formulas: Double definition `$2=' in TBLFM  
> line, please fix by hand
>
> I don't understand this - if @III+1$w works for the second column in  
> the
> Used row, why doesn't @III+2$2 work for the second column in the
> Remaining row ?
>
> Any help appreciated.
>
> Regards
> Pete
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problems with table mode
       [not found]   ` <18940.1208723747@localhost>
@ 2008-04-21  6:13     ` Carsten Dominik
  2008-04-21  6:38       ` Pete Phillips
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2008-04-21  6:13 UTC (permalink / raw)
  To: Pete Phillips; +Cc: org-mode mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1336 bytes --]


On Apr 20, 2008, at 10:35 PM, Pete Phillips wrote:

> Evening Carsten
>>>>>> "Carsten" == Carsten Dominik <dominik@science.uva.nl> writes:
>
>    Carsten> constructs like @III+1$2 are not allowed on the left side
>    Carsten> of a formula.  The left side must be either $N for a
>    Carsten> column, or @M$N for a field.  The error message stems from
>    Carsten> the face that the scanner for formulas ignores the
>    Carsten> @III... spec and reads both formulas as $2=....
>
>
> Hmm - so how do I tell it which is the correct cell to put the
> calculation in ? I've clearly missed something vital here.
>
> Pete

Hi Phil,

the correct formula line would be

#+TBLFM: @6$2=vsum(@II+1$2..@III-1$2)::@7$2=@1$2+@2$2-@III+1

Take a look at Bastien's tutorial about table calculations in Org:

http://legito.net/worg/org-tutorials/org-spreadsheet-intro.php

In order to make sure that the formula stays correct, you need to
make sure that you add more lines to the table only with the
proper command M-S-<down>.  When using this command, the absolute
references in the formulas are modified.

I can see that a construct like you have been using would be
useful, because it would allow normal editing of the table and still
keep the correct results.  I have taken a note, maybe this
can be implemented at some point.


HTH

- Carsten


[-- Attachment #1.2: Type: text/html, Size: 2443 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problems with table mode
  2008-04-21  6:13     ` Carsten Dominik
@ 2008-04-21  6:38       ` Pete Phillips
  0 siblings, 0 replies; 4+ messages in thread
From: Pete Phillips @ 2008-04-21  6:38 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: org-mode mailing list

Hi Carsten

>>>>> "Carsten" == Carsten Dominik <dominik@science.uva.nl> writes:

    Carsten> the correct formula line would be

    Carsten> #+TBLFM:
    Carsten> @6$2=vsum(@II+1$2..@III-1$2)::@7$2=@1$2+@2$2-@III+1

Well, this is what I have been using, but I've had to change it each
time I add a new date. Hence my search for something more generic.

    Carsten> In order to make sure that the formula stays correct, you
    Carsten> need to make sure that you add more lines to the table only
    Carsten> with the proper command M-S-<down>.  When using this
    Carsten> command, the absolute references in the formulas are
    Carsten> modified.

Ah - OK - this is clearly a solution - I have been using kill and yank
commands to add new entries.

    Carsten> I can see that a construct like you have been using would
    Carsten> be useful, because it would allow normal editing of the
    Carsten> table and still keep the correct results.  I have taken a
    Carsten> note, maybe this can be implemented at some point.

OK - not a major problem now I understand what the problem is.

Thanks
Pete

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-21  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-20 19:32 problems with table mode Pete Phillips
2008-04-20 20:27 ` Carsten Dominik
     [not found]   ` <18940.1208723747@localhost>
2008-04-21  6:13     ` Carsten Dominik
2008-04-21  6:38       ` Pete Phillips

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).