emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Daniel Gerber <daniel.g.gerber@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Spreadsheet - issue with remote reference to named column
Date: Thu, 17 Sep 2015 22:05:26 +0200	[thread overview]
Message-ID: <874misvmk9.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <55F1806A.2020201@gmail.com> (Daniel Gerber's message of "Thu, 10 Sep 2015 15:06:50 +0200")

Hello,

Daniel Gerber <daniel.g.gerber@gmail.com> writes:

> The docs say that the REF argument to remote can be "@3$3 or $somename, 
> valid in the referenced table". So, adapting the tutorial, the last 
> column here should get the same values as the second one, right?
>
>
> | currency | rate (@r$c ref) | rate (named ref) |
> |----------+-----------------+------------------|
> | eur      |               1 | nil              |
> | usd      |            0.77 | nil              |
> | sek      |            0.12 | nil              |
> | sek      |            0.12 | nil              |
> | sek      |            0.12 | nil              |
> | nok      |            0.14 | nil              |
> |          |             nil |                  |
>   #+TBLFM: $2='(org-lookup-first $1 '(remote(rates,@2$2..@>$2)) 
> '(remote(rates,@2$3..@>$3)))::$3='(org-lookup-first $1 
> '(remote(rates,$abbr)) '(remote(rates,$euros)))
>
>
>   #+TBLNAME: rates
> | ! | abbr | euros |
> |---+------+-------|
> |   | eur  |     1 |
> |   | nok  |  0.14 |
> |   | sek  |  0.12 |
> |   | usd  |  0.77 |

Actually, wrong.

$abbr (respectively $euros) in this case is equivalent to $2
(respectively $3). So your formula becomes

  $3='(org-lookup-first $1 '(remote(rates,$2)) '(remote(rates,$3)))

However, $2, or $3, are not valid range references so you do not get
vector of values.  However, the following should work as expected

  '(org-lookup-first $1 '(remote(rates,@2$abbr..@>$abbr)) '(remote(rates,@2$euros..@>$euros)))

Regards,

-- 
Nicolas Goaziou

      reply	other threads:[~2015-09-17 20:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 13:06 Spreadsheet - issue with remote reference to named column Daniel Gerber
2015-09-17 20:05 ` Nicolas Goaziou [this message]

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=874misvmk9.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=daniel.g.gerber@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).