emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Spreadsheet - issue with remote reference to named column
@ 2015-09-10 13:06 Daniel Gerber
  2015-09-17 20:05 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Gerber @ 2015-09-10 13:06 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

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 |



Thanks for your answers!


Daniel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Spreadsheet - issue with remote reference to named column
  2015-09-10 13:06 Spreadsheet - issue with remote reference to named column Daniel Gerber
@ 2015-09-17 20:05 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2015-09-17 20:05 UTC (permalink / raw)
  To: Daniel Gerber; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-17 20:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-10 13:06 Spreadsheet - issue with remote reference to named column Daniel Gerber
2015-09-17 20:05 ` Nicolas Goaziou

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).