From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: date calculation in org table Date: Thu, 23 May 2013 10:24:28 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfQpH-0002SQ-4e for emacs-orgmode@gnu.org; Thu, 23 May 2013 04:24:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfQp4-00024F-2i for emacs-orgmode@gnu.org; Thu, 23 May 2013 04:24:42 -0400 Received: from mail-la0-x233.google.com ([2a00:1450:4010:c03::233]:34210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfQp3-00023w-Gk for emacs-orgmode@gnu.org; Thu, 23 May 2013 04:24:29 -0400 Received: by mail-la0-f51.google.com with SMTP id lx15so2948949lab.38 for ; Thu, 23 May 2013 01:24:28 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: The Dude Cc: Org Mode Hi Rafal On Thu, May 23, 2013 at 8:43 AM, The Dude wrote: > The problem is that when I change the $sdate and recalculate the whole > table with `C-u C-u C-c C-c' only the element @4$4 is set. It seems > like the column formula doesn't apply to the other fields. This I consider a bug, minimal example: | # | a | a | | | b | | #+TBLFM: $3 = $2 | | a | a | | | b | b | #+TBLFM: $3 = $2 > | | WP | Days | Arrival Date | > |---+----+------+------------------| > | # | | | <2013-06-05 Wed> | > | ^ | | | sdate | > |---+----+------+------------------| > | | 1 | 4 | <2013-06-09 Sun> | > | | - | 2 | <2013-06-11 Tue> | > | | 2 | 4 | <2013-06-15 Sat> | > | | - | 2 | <2013-06-17 Mon> | > | | 3 | 1 | <2013-06-18 Tue> | > | | 4 | 2 | <2013-06-20 Thu> | > | | 5 | 1 | <2013-06-21 Fri> | > | | - | 2 | <2013-06-23 Sun> | > | | 6 | 1 | <2013-06-24 Mon> | > | | 7 | 2 | <2013-06-26 Wed> | > | | - | 1 | <2013-06-27 Thu> | > | | 8 | 1 | <2013-06-28 Fri> | > | | 9 | 1 | <2013-06-29 Sat> | > | | - | 3 | <2013-07-02 Tue> | > | | 10 | 3 | <2013-07-05 Fri> | > | | - | 1 | <2013-07-06 Sat> | > | | 11 | 2 | <2013-07-08 Mon> | > |---+----+------+------------------| > | | | 33 | <2013-07-08 Mon> | > #+TBLFM: @4$4=$sdate + $3::$4=@-1$4+$3::@21$3=vsum(@II..@III)::@21$4=@III-1::$sdate=<2013-06-05 Wed> Let me suggest one more variant. No row numbers, uses the fact that the formula for $3 is not evaluated in the header and it circumvents the bug: | | WP | Days | Arrival Date | | | | | <2013-06-05 Wed> | |---+----+------+------------------| | | 1 | 4 | <2013-06-09 Sun> | | | - | 2 | <2013-06-11 Tue> | | | 2 | 4 | <2013-06-15 Sat> | | | - | 2 | <2013-06-17 Mon> | | | 3 | 1 | <2013-06-18 Tue> | | | 4 | 2 | <2013-06-20 Thu> | | | 5 | 1 | <2013-06-21 Fri> | | | - | 2 | <2013-06-23 Sun> | | | 6 | 1 | <2013-06-24 Mon> | | | 7 | 2 | <2013-06-26 Wed> | | | - | 1 | <2013-06-27 Thu> | | | 8 | 1 | <2013-06-28 Fri> | | | 9 | 1 | <2013-06-29 Sat> | | | - | 3 | <2013-07-02 Tue> | | | 10 | 3 | <2013-07-05 Fri> | | | - | 1 | <2013-07-06 Sat> | | | 11 | 2 | <2013-07-08 Mon> | |---+----+------+------------------| | | | 33 | <2013-07-08 Mon> | #+TBLFM: $4 = @-1 + $3 :: @>$3 = vsum(@I..@II) :: @>$4 = @-1 Michael