emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Relative Remote Reference (column->row)
@ 2014-03-21  0:31 Volker Strobel
  2014-03-21  7:19 ` Michael Brand
  0 siblings, 1 reply; 3+ messages in thread
From: Volker Strobel @ 2014-03-21  0:31 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 690 bytes --]

Hi there,

I'm trying to refer to the row number of a remote table, using the current
column number shifted by one.

Remote Table:
#+NAME: my-table
| Header1 | Header2 |
|---------+---------|
|   a     |    23  |
|   b     |    7    |
|   c     |    13  |
|   d     |    66  |
|   e     |    5    |
|---------+---------|
| Result  |  42 |


Table where remote value should be inserted:
...
#+TBLFM: @1$3..@1$7= remote(my-table,@$#$2)

My problem is, that this remote reference starts in row 3 (because of @$#),
however, I'd like to start in row 2 (that means @$#-1). However, this
relative reference does not seem to work here.

Any idea what command I can use here?

Thanks!

Best, Volker

[-- Attachment #2: Type: text/html, Size: 923 bytes --]

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

* Re: Relative Remote Reference (column->row)
  2014-03-21  0:31 Relative Remote Reference (column->row) Volker Strobel
@ 2014-03-21  7:19 ` Michael Brand
  2014-03-23 21:20   ` Volker Strobel
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Brand @ 2014-03-21  7:19 UTC (permalink / raw)
  To: Volker Strobel; +Cc: Org Mode

Hi Volker

On Fri, Mar 21, 2014 at 1:31 AM, Volker Strobel
<volker.strobel87@gmail.com> wrote:
> My problem is, that this remote reference starts in row 3 (because of @$#),
> however, I'd like to start in row 2 (that means @$#-1). However, this
> relative reference does not seem to work here.

Calculation within the field reference of Org is not supported but
subscr of Calc can be used to pick calculated references from a range:

#+NAME: my-table
| Header1 | Header2 |
|---------+---------|
| a       |      23 |
| b       |       7 |
| c       |      13 |
| d       |      66 |
| e       |       5 |
|---------+---------|
| Result  |      42 |

| x | y | 23 | 7 | 13 | 66 | 5 |
#+TBLFM: @1$3..@1$7 = subscr(remote(my-table, @2$2..6$2), $# - 2)

(To show the intermediade step:
| x | y | [23, 7, 13, 66, 5] | [23, 7, 13, 66, 5] |
#+TBLFM: @1$3..@1$4 = remote(my-table, @2$2..6$2)
)

Michael

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

* Re: Relative Remote Reference (column->row)
  2014-03-21  7:19 ` Michael Brand
@ 2014-03-23 21:20   ` Volker Strobel
  0 siblings, 0 replies; 3+ messages in thread
From: Volker Strobel @ 2014-03-23 21:20 UTC (permalink / raw)
  To: Michael Brand; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

Thanks, Michael, for this helpful workaround!


On Fri, Mar 21, 2014 at 8:19 AM, Michael Brand
<michael.ch.brand@gmail.com>wrote:

> Hi Volker
>
> On Fri, Mar 21, 2014 at 1:31 AM, Volker Strobel
> <volker.strobel87@gmail.com> wrote:
> > My problem is, that this remote reference starts in row 3 (because of
> @$#),
> > however, I'd like to start in row 2 (that means @$#-1). However, this
> > relative reference does not seem to work here.
>
> Calculation within the field reference of Org is not supported but
> subscr of Calc can be used to pick calculated references from a range:
>
> #+NAME: my-table
> | Header1 | Header2 |
> |---------+---------|
> | a       |      23 |
> | b       |       7 |
> | c       |      13 |
> | d       |      66 |
> | e       |       5 |
> |---------+---------|
> | Result  |      42 |
>
> | x | y | 23 | 7 | 13 | 66 | 5 |
> #+TBLFM: @1$3..@1$7 = subscr(remote(my-table, @2$2..6$2), $# - 2)
>
> (To show the intermediade step:
> | x | y | [23, 7, 13, 66, 5] | [23, 7, 13, 66, 5] |
> #+TBLFM: @1$3..@1$4 = remote(my-table, @2$2..6$2)
> )
>
> Michael
>

[-- Attachment #2: Type: text/html, Size: 1652 bytes --]

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

end of thread, other threads:[~2014-03-23 21:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-21  0:31 Relative Remote Reference (column->row) Volker Strobel
2014-03-21  7:19 ` Michael Brand
2014-03-23 21:20   ` Volker Strobel

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