From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Spreadsheet - issue with remote reference to named column Date: Thu, 17 Sep 2015 22:05:26 +0200 Message-ID: <874misvmk9.fsf@nicolasgoaziou.fr> References: <55F1806A.2020201@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcfPN-00068L-JT for emacs-orgmode@gnu.org; Thu, 17 Sep 2015 16:03:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcfPM-00043i-Ne for emacs-orgmode@gnu.org; Thu, 17 Sep 2015 16:03:53 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:53630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcfPM-000420-GU for emacs-orgmode@gnu.org; Thu, 17 Sep 2015 16:03:52 -0400 In-Reply-To: <55F1806A.2020201@gmail.com> (Daniel Gerber's message of "Thu, 10 Sep 2015 15:06:50 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Daniel Gerber Cc: emacs-orgmode@gnu.org Hello, Daniel Gerber 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