emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Table Formula: Update column, then update value
@ 2014-09-11 14:00 Tory S. Anderson
  2014-09-11 14:30 ` Eric S Fraga
  0 siblings, 1 reply; 4+ messages in thread
From: Tory S. Anderson @ 2014-09-11 14:00 UTC (permalink / raw)
  To: orgmode list

I have a table that calculates daily cost and then sums the hours and the weekly cost. But I can't seem to get a formula that will do the former.

  | Date         | Hours | Rate | Cost |
  |--------------+-------+------+------|
  | September 8  |  0.50 |    1 |   1. |
  | September 9  |  2.00 |    1 |   2. |
  | September 10 |  2.00 |    1 |   2. |
  | September 11 |  2.00 |    1 |   2. |
  | September 12 |  2.00 |    1 |   2. |
  |--------------+-------+------+------|
  |              |   8.5 |      | 399. |
  | ^            |   hrs |      |  ttl |
  #+TBLFM: $hrs=vsum(@I..II)::$ttl=vsum(@I..II)

Before the formula above works, I end up pasting the following line just below the last date (above the @II line): 

  #+TBLFM: $4=vsum($2*$3)

So, I have to copy-paste into the middle of my table, run the line, then cut the line back out of the table and run the lower line. I'm just sure there's a better way; it even seems like once upon a time I had something working. But is there a non-repetitive way to autofill the COST ($4) column between @I..II without wiping out everything else? 

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

* Re: Table Formula: Update column, then update value
  2014-09-11 14:00 Table Formula: Update column, then update value Tory S. Anderson
@ 2014-09-11 14:30 ` Eric S Fraga
  2014-09-11 14:50   ` Tory S. Anderson
  0 siblings, 1 reply; 4+ messages in thread
From: Eric S Fraga @ 2014-09-11 14:30 UTC (permalink / raw)
  To: Tory S. Anderson; +Cc: orgmode list

[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

On Thursday, 11 Sep 2014 at 10:00, Tory S. Anderson wrote:
> I have a table that calculates daily cost and then sums the hours and
> the weekly cost. But I can't seem to get a formula that will do the
> former.
>
>   | Date         | Hours | Rate | Cost |
>   |--------------+-------+------+------|
>   | September 8  |  0.50 |    1 |   1. |
>   | September 9  |  2.00 |    1 |   2. |
>   | September 10 |  2.00 |    1 |   2. |
>   | September 11 |  2.00 |    1 |   2. |
>   | September 12 |  2.00 |    1 |   2. |
>   |--------------+-------+------+------|
>   |              |   8.5 |      | 399. |
>   | ^            |   hrs |      |  ttl |
>
>   #+TBLFM: $hrs=vsum(@I..II)::$ttl=vsum(@I..II)
>
> Before the formula above works, I end up pasting the following line
> just below the last date (above the @II line):
>
>   #+TBLFM: $4=vsum($2*$3)

>
> So, I have to copy-paste into the middle of my table, run the line,
> then cut the line back out of the table and run the lower line. I'm
> just sure there's a better way; it even seems like once upon a time I
> had something working. But is there a non-repetitive way to autofill
> the COST ($4) column between @I..II without wiping out everything
> else?

I am not sure what is the problem here.  The above table works fine for
me with this TBLFM line:

    #+TBLFM: $4=$3*$2::$hrs=vsum(@I..II)::$ttl=vsum(@I..II)

What is it you expect?  Note, your September 8 entry for the cost is
wrong... but will get updated if you use this TBLFM line.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.1, Org release_8.3beta-320-gb5c9de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 180 bytes --]

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

* Re: Table Formula: Update column, then update value
  2014-09-11 14:30 ` Eric S Fraga
@ 2014-09-11 14:50   ` Tory S. Anderson
  2014-09-11 18:21     ` Eric S Fraga
  0 siblings, 1 reply; 4+ messages in thread
From: Tory S. Anderson @ 2014-09-11 14:50 UTC (permalink / raw)
  To: orgmode list

When I apply the formula 
  #+TBLFM: $4=$3*$2::$hrs=vsum(@I..II)::$ttl=vsum(@I..II)
It doesn't give me any errors, but it also doesn't do anything to $4. So if I change one of my hour amounts, the "hrs" field will update appropriately, but not the "cost" field, which remains unchanged. It appears that the initial formula is not doing anything. 

Org-mode version 8.2.7c (8.2.7c-61-g4b9146-elpa


Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Thursday, 11 Sep 2014 at 10:00, Tory S. Anderson wrote:
>> I have a table that calculates daily cost and then sums the hours and
>> the weekly cost. But I can't seem to get a formula that will do the
>> former.
>>
>>   | Date         | Hours | Rate | Cost |
>>   |--------------+-------+------+------|
>>   | September 8  |  0.50 |    1 |   1. |
>>   | September 9  |  2.00 |    1 |   2. |
>>   | September 10 |  2.00 |    1 |   2. |
>>   | September 11 |  2.00 |    1 |   2. |
>>   | September 12 |  2.00 |    1 |   2. |
>>   |--------------+-------+------+------|
>>   |              |   8.5 |      | 399. |
>>   | ^            |   hrs |      |  ttl |
>>
>>   #+TBLFM: $hrs=vsum(@I..II)::$ttl=vsum(@I..II)
>>
>> Before the formula above works, I end up pasting the following line
>> just below the last date (above the @II line):
>>
>>   #+TBLFM: $4=vsum($2*$3)
>
>>
>> So, I have to copy-paste into the middle of my table, run the line,
>> then cut the line back out of the table and run the lower line. I'm
>> just sure there's a better way; it even seems like once upon a time I
>> had something working. But is there a non-repetitive way to autofill
>> the COST ($4) column between @I..II without wiping out everything
>> else?
>
> I am not sure what is the problem here.  The above table works fine for
> me with this TBLFM line:
>
>     #+TBLFM: $4=$3*$2::$hrs=vsum(@I..II)::$ttl=vsum(@I..II)
>
> What is it you expect?  Note, your September 8 entry for the cost is
> wrong... but will get updated if you use this TBLFM line.

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

* Re: Table Formula: Update column, then update value
  2014-09-11 14:50   ` Tory S. Anderson
@ 2014-09-11 18:21     ` Eric S Fraga
  0 siblings, 0 replies; 4+ messages in thread
From: Eric S Fraga @ 2014-09-11 18:21 UTC (permalink / raw)
  To: Tory S. Anderson; +Cc: orgmode list

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

On Thursday, 11 Sep 2014 at 10:50, Tory S. Anderson wrote:
> When I apply the formula 
>
>   #+TBLFM: $4=$3*$2::$hrs=vsum(@I..II)::$ttl=vsum(@I..II)
> It doesn't give me any errors, but it also doesn't do anything to
> $4. So if I change one of my hour amounts, the "hrs" field will update
> appropriately, but not the "cost" field, which remains unchanged. It
> appears that the initial formula is not doing anything.
>
> Org-mode version 8.2.7c (8.2.7c-61-g4b9146-elpa

You are correct.  I get the same behaviour.  Definitely a bug.

If you remove the last line (with labels) and replace the last row
formulae with direct references, it works.

 #+TBLFM: $4=$3*$2::@7$2=vsum(@I..@II)::@7$4=vsum(@I..@II)
 
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.1, Org release_8.3beta-320-gb5c9de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 180 bytes --]

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

end of thread, other threads:[~2014-09-11 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 14:00 Table Formula: Update column, then update value Tory S. Anderson
2014-09-11 14:30 ` Eric S Fraga
2014-09-11 14:50   ` Tory S. Anderson
2014-09-11 18:21     ` Eric S Fraga

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