emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Derek Feichtinger <dfeich@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org table with auto-incrementing numbers in a column
Date: Tue, 16 Feb 2016 17:51:19 +0100	[thread overview]
Message-ID: <87io1oppiw.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <loom.20160216T095701-420@post.gmane.org> (Derek Feichtinger's message of "Tue, 16 Feb 2016 09:16:38 +0000 (UTC)")

Hello,

Derek Feichtinger <dfeich@gmail.com> writes:

> When I use this formula
>
> #+TBLFM: $1= @-1 + 1:: @2$1=1
>
> Then org will first fill this part of the table (starting at cell <at>2$1)
>
>   | N |   |
>   |---+---|
>   |   |   |
>   | 1 |   |
>   | 2 |   |
>   | 3 |   |
>   #+TBLFM: $1= <at>-1 + 1:: <at>2$1=1
>
> Then it will execute the second formula, which sets the value in row 2:
>
>   | N |   |
>   |---+---|
>   | 1 |   |
>   | 1 |   |
>   | 2 |   |
>   | 3 |   |
>
> Only upon a second evaluation of the whole table, it will arrive at
>
>   | N |   |
>   |---+---|
>   | 1 |   |
>   | 2 |   |
>   | 3 |   |
>   | 4 |   |
>
> So, this is one of the cases where one needs to carry our iterations until
> the table stays constant (can use org-table-iterate).
>
> I also tried the same with changing the order of the two formulas. Seems
> that the row formula always is executed first. So, at least this is
> consistent. Why it starts at row 3 one would need to look up in the
> source...

Field formulas bind stronger than column formulas. 

First, all cells with an associated field formula are marked as
read-only. Then column formulas are evaluated. Eventually, fields
formulas are evaluated.

This was introduced in Org 5.01, AFAICT. Before, the "read-only" part
would not happens, i.e, fields formulas would overwrite column formulas.

I think the idea behind this is that formulas are applied to the current
state of the table, not some intermediate one, with some formulas
applied and others not.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-02-16 16:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16  4:36 org table with auto-incrementing numbers in a column Kaushal Modi
2016-02-16  6:22 ` Derek Feichtinger
2016-02-16  7:24   ` H. Dieter Wilhelm
2016-02-16  9:16     ` Derek Feichtinger
2016-02-16 16:51       ` Nicolas Goaziou [this message]
2016-02-16  9:58   ` Eric S Fraga
2016-02-16 16:28     ` Kaushal Modi

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=87io1oppiw.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=dfeich@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).