[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Tables: remote reference fails with umlaut (and in other cases)
From: |
Michael Brand |
Subject: |
Re: [O] Tables: remote reference fails with umlaut (and in other cases) |
Date: |
Mon, 25 Jan 2016 18:57:06 +0100 |
Hi Karl
> I tried to reference "the item one row up" via @@#-1$1 (and similar)
> and failed. Is there a way to accomplish this as well?
It fails because @@#-1$1 is only substituted with @1-1$1, @2-1$1 etc.
depending on the row it is evaluated on.
To be able to use an expression as the index for an indirection one
can select the element from a Calc vector or Lisp list. For a Calc
formula example please e. g. look for the Calc function subscr() in
http://orgmode.org/worg/org-hacks.html#field-coordinates-in-formulas
Beware of the formula modifier E to keep empty fields counting for the
position:
| 1 | | |
|---+-----+---|
| 2 | 1 | 1 |
| | 2 | 2 |
| 4 | nan | 4 |
#+TBLFM: $2 = subscr(@<$1..@>$1, @# - 1); E :: $3 = subscr(@<$1..@>$1, @# - 1)
| 1st | | |
|-----+-----+-----|
| 2nd | 1st | 1st |
| | 2nd | 2nd |
| 4th | | 4th |
#+TBLFM: $2 = '(nth (- @# 2) '(@<$1..@>$1)); E :: $3 = '(nth (- @# 2)
'(@<$1..@>$1))
>>> [1]
>>> https://github.com/novoid/org-mode-workshop/blob/master/featureshow/org-mode-teaser.org#1131-referencing-example-with-detailed-explanation
>>
>> Do you remember that some time ago I reminded you about a patch that I
>> had sent you privately to align your above URL with the change about how
>> to copy fields in the Org manual?
>
> A big sorry from my side: I did not process your email for too many
> months. Thanks for contributing to my tutorial!
Thank you for applying my patch for the section "column-based".
Attached is another patch for the section "row-based" which I somehow
missed in the first place.
The sentence "the identity statement prevents calc from interpreting
the content" that you added might be misleading because the formula is
now a Lisp formula '(func ...), with a mandatory function in its first
place and Calc is not involved.
Btw. I failed to find a Calc formula as capable as the Lisp formula to
copy content one to one. Some time ago I documented my trials into
this direction in test-org-table/copy-field in
testing/lisp/test-org-table.el.
Michael
row-based.diff
Description: Text document
Re: [O] Tables: remote reference fails with umlaut (and in other cases), Stefan Huchler, 2016/01/19