[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] date calculation in org table
From: |
Michael Brand |
Subject: |
Re: [O] date calculation in org table |
Date: |
Thu, 23 May 2013 10:24:28 +0200 |
Hi Rafal
On Thu, May 23, 2013 at 8:43 AM, The Dude <address@hidden> 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::address@hidden::@21$3=vsum(@address@hidden)::@address@hidden::$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(@address@hidden) :: @>$4 = @-1
Michael