emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dante Catalfamo <dante@lambda.cx>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: Can’t assign to hline relative reference
Date: Thu, 22 Oct 2020 19:56:53 +0000	[thread overview]
Message-ID: <efa08c80-893f-7cd9-6bff-f36158ecc3ca@lambda.cx> (raw)
In-Reply-To: <rmrsgn$54r$1@ciao.gmane.io>

That seems to work for the most part, but now I'm experiencing a strange 
difference when evaluating. If I use a formula like

 
#+TBLFM:@2$3..@23$3=if($2!=0,12*$2,$3);%.2f::@24$2=vsum(@I..@II);%.2f::@24$3=vsum(@I..@II);%.2f

The column gets evaluated first, then the sum at the bottom gets 
evaluated, resulting in what I'd expect. But if I use a formula like

#+TBLFM:@<<$3..@>>$3=if($2!=0,12*$2,$3);%.2f::@24$2=vsum(@I..@II);%.2f::@24$3=vsum(@I..@II);%.2f

The sum gets calculated first, and the column after, meaning the sum 
doesn't reflect any changes made before calculation. I find this pretty 
strange considering the formulas are in the same order. Do formulas 
involving relative references get calculated last for some reason?

On 2020-10-22 8:04 a.m., Maxim Nikulin wrote:
> 
> Dante Catalfamo wrote:
>> In the case where I'm using this formula, there are many more rows
>> between @I..@II. I only used two in the example to keep the email small.
>> I would also be adding more rows regularly, making it slightly
>> impractical to be adjusting the beginning and end points of the formula
>> every time I add or remove a row. I appreciate your suggestion, though I
>> was hoping for a more convenient solution. If nothing else works, that's
>> what I'll do.
> 
> You are not alone. From my point of view it is not clear enough from org
> manual that @I references could be used only to the right of "=". The
> error message was a bad surprize. Another similar pitfal was with named
> columns.
> 
> However in some cases @<< (unlike @2 remains unchanged if a new line is
> added before second row) and @>> could be a workaround. If there are
> several horizontal lines, sometimes it is possible to mark particular
> lines with # and use e.g. $3=vsum(@-I$-1..@+I$-1) to avoid proliferation
> of same formulas for each table section.
> 
> 



  reply	other threads:[~2020-10-22 19:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21  1:14 Bug: Can’t assign to hline relative reference Dante Catalfamo
2020-10-21 12:43 ` Daniel Herzig
2020-10-21 16:14   ` Dante Catalfamo
2020-10-22 12:04     ` Maxim Nikulin
2020-10-22 19:56       ` Dante Catalfamo [this message]
2020-10-29 12:40         ` Maxim Nikulin
  -- strict thread matches above, loose matches on Subject: below --
2020-10-20 21:39 Dante Catalfamo

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=efa08c80-893f-7cd9-6bff-f36158ecc3ca@lambda.cx \
    --to=dante@lambda.cx \
    --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).