emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: The Dude <rafal.kowalski@mac.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: date calculation in org table
Date: Thu, 23 May 2013 10:24:28 +0200	[thread overview]
Message-ID: <CALn3zog1UVRks+EhnM5i86JxQHxx3nVoN+_6bxjO4hz6pbMFOg@mail.gmail.com> (raw)
In-Reply-To: <m2sj1ekxh9.fsf@mac.com>

Hi Rafal

On Thu, May 23, 2013 at 8:43 AM, The Dude <rafal.kowalski@mac.com> 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

  parent reply	other threads:[~2013-05-23  8:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23  6:43 date calculation in org table The Dude
2013-05-23  7:22 ` Christian Moe
2013-05-23  7:51   ` The Dude
2013-05-23  8:24 ` Michael Brand [this message]
2013-05-23 14:47   ` The Dude
2013-05-23 15:02     ` Michael Brand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALn3zog1UVRks+EhnM5i86JxQHxx3nVoN+_6bxjO4hz6pbMFOg@mail.gmail.com \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rafal.kowalski@mac.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).