* Tables: remote reference fails with umlaut (and in other cases)
@ 2016-01-19 13:10 Karl Voit
2016-01-19 15:12 ` Eric S Fraga
2016-01-19 16:32 ` Stefan Huchler
0 siblings, 2 replies; 10+ messages in thread
From: Karl Voit @ 2016-01-19 13:10 UTC (permalink / raw)
To: emacs-orgmode
Hi!
Either I found a bug when referring to other table rows or I don't
understand the behavior of following example tables. My expectation
was that the first column of the second table is exactly the same as
the first column of the first table:
#+NAME: 2016-01-19-srctbl
| Testdata |
|----------|
| foobar |
| fooübar |
| fooßbar |
| 1er |
| 23,42 |
| 23.42 |
| Result | Expected Result | Comparison |
|----------+-----------------+----------------|
| foobar | foobar | OK |
| #ERROR | fooübar | fail |
| #ERROR | fooßbar | fail |
| er | 1er | fail |
| 23.42 | 23.42 | OK |
| (23, 42) | 23,42 | probably fail? |
#+TBLFM: $1=remote(2016-01-19-srctbl,@@#$1)
Thanks for clearing things up!
--
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
> get Memacs from https://github.com/novoid/Memacs <
https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Tables: remote reference fails with umlaut (and in other cases)
2016-01-19 13:10 Tables: remote reference fails with umlaut (and in other cases) Karl Voit
@ 2016-01-19 15:12 ` Eric S Fraga
2016-01-19 15:29 ` Karl Voit
2016-01-19 16:40 ` Nick Dokos
2016-01-19 16:32 ` Stefan Huchler
1 sibling, 2 replies; 10+ messages in thread
From: Eric S Fraga @ 2016-01-19 15:12 UTC (permalink / raw)
To: Karl Voit; +Cc: Karl Voit, emacs-orgmode
On Tuesday, 19 Jan 2016 at 14:10, Karl Voit wrote:
> Hi!
>
> Either I found a bug when referring to other table rows or I don't
> understand the behavior of following example tables. My expectation
> was that the first column of the second table is exactly the same as
> the first column of the first table:
>
> #+NAME: 2016-01-19-srctbl
> | Testdata |
>
> |----------|
> | foobar |
> | fooübar |
> | fooßbar |
> | 1er |
> | 23,42 |
> | 23.42 |
>
> | Result | Expected Result | Comparison |
> |----------+-----------------+----------------|
> | foobar | foobar | OK |
> | #ERROR | fooübar | fail |
> | #ERROR | fooßbar | fail |
> | er | 1er | fail |
> | 23.42 | 23.42 | OK |
> | (23, 42) | 23,42 | probably fail? |
>
> #+TBLFM: $1=remote(2016-01-19-srctbl,@@#$1)
>
> Thanks for clearing things up!
I cannot get this to work either but I do think you want to enclose the
remote() within (identity) to copy values and not try to evaluate an
expression, as noted in the info page:
$1=(identity remote(2016-01-19-srctbl,@@#$1))
Also, I don't think you want an indirection using #.
But I cannot get this to work so I could be completely off base...
--
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.3-449-gd85ff3
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Tables: remote reference fails with umlaut (and in other cases)
2016-01-19 15:12 ` Eric S Fraga
@ 2016-01-19 15:29 ` Karl Voit
2016-01-19 19:04 ` Michael Brand
2016-01-19 16:40 ` Nick Dokos
1 sibling, 1 reply; 10+ messages in thread
From: Karl Voit @ 2016-01-19 15:29 UTC (permalink / raw)
To: emacs-orgmode
Hi Eric,
* Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> On Tuesday, 19 Jan 2016 at 14:10, Karl Voit wrote:
>>
>> #+NAME: 2016-01-19-srctbl
>> | Testdata |
>> |----------|
>> | foobar |
>> | fooübar |
>> | fooßbar |
>> | 1er |
>> | 23,42 |
>> | 23.42 |
>>
>> | Result | Expected Result | Comparison |
>> |----------+-----------------+----------------|
>> | foobar | foobar | OK |
>> | #ERROR | fooübar | fail |
>> | #ERROR | fooßbar | fail |
>> | er | 1er | fail |
>> | 23.42 | 23.42 | OK |
>> | (23, 42) | 23,42 | probably fail? |
>>
>> #+TBLFM: $1=remote(2016-01-19-srctbl,@@#$1)
>
> I cannot get this to work either but I do think you want to enclose the
> remote() within (identity) to copy values and not try to evaluate an
> expression, as noted in the info page:
>
> $1=(identity remote(2016-01-19-srctbl,@@#$1))
| Result | Expected Result |
|------------------+-----------------|
| identity(foobar) | foobar |
| #ERROR | fooübar |
| #ERROR | fooßbar |
| identity(er) | 1er |
| identity(23, 42) | 23.42 |
| identity(23.42) | 23,42 |
#+TBLFM: $1=(identity remote(2016-01-19-srctbl,@@#$1))
> Also, I don't think you want an indirection using #.
I never understood the @@#-syntax anyway. On [1] I referenced to [2].
> But I cannot get this to work so I could be completely off base...
Interesting. I thought I am using only standard Org functionality here.
I'm using the most current Git maint version, btw.
[1] https://github.com/novoid/org-mode-workshop/blob/master/featureshow/org-mode-teaser.org#1131-referencing-example-with-detailed-explanation
[2] http://orgmode.org/worg/org-hacks.html#field-coordinates-in-formulas
--
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
> get Memacs from https://github.com/novoid/Memacs <
https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Tables: remote reference fails with umlaut (and in other cases)
2016-01-19 13:10 Tables: remote reference fails with umlaut (and in other cases) Karl Voit
2016-01-19 15:12 ` Eric S Fraga
@ 2016-01-19 16:32 ` Stefan Huchler
1 sibling, 0 replies; 10+ messages in thread
From: Stefan Huchler @ 2016-01-19 16:32 UTC (permalink / raw)
To: emacs-orgmode
Karl Voit <devnull@Karl-Voit.at> writes:
> #+NAME: 2016-01-19-srctbl
> | Testdata |
> |----------|
> | foobar |
> | fooübar |
> | fooßbar |
> | 1er |
> | 23,42 |
> | 23.42 |
>
> | Result | Expected Result | Comparison |
> |----------+-----------------+----------------|
> | foobar | foobar | OK |
> | #ERROR | fooübar | fail |
> | #ERROR | fooßbar | fail |
> | er | 1er | fail |
> | 23.42 | 23.42 | OK |
> | (23, 42) | 23,42 | probably fail? |
> #+TBLFM: $1=remote(2016-01-19-srctbl,@@#$1)
Yes I have that problem, too. the last number is strange. I had the
problem that I used 45.000 as the german seperator for thousends and it
interpreted it as dezimal english "." so you have to put the string into
"" to mark it as string the result sadly still has the "" around it but
it makes kind of sense. the german umlauts just fail/error here too.
would happy to have here a solution sadly org tables fail for me for
most tasks because it only works useful good with calculations and
numbers, if you dont learn R and maybe use there some magic.
Sorry dont want to be negative but run against many walls and got not
very satisfactory answers to it, most of the time something like WONTFIX
or ITSNOTABUGITSAFEATURE as answer.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Tables: remote reference fails with umlaut (and in other cases)
2016-01-19 15:12 ` Eric S Fraga
2016-01-19 15:29 ` Karl Voit
@ 2016-01-19 16:40 ` Nick Dokos
2016-01-19 22:28 ` Stefan Huchler
2016-01-20 12:01 ` Karl Voit
1 sibling, 2 replies; 10+ messages in thread
From: Nick Dokos @ 2016-01-19 16:40 UTC (permalink / raw)
To: emacs-orgmode
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> On Tuesday, 19 Jan 2016 at 14:10, Karl Voit wrote:
>> Hi!
>>
>> Either I found a bug when referring to other table rows or I don't
>> understand the behavior of following example tables. My expectation
>> was that the first column of the second table is exactly the same as
>> the first column of the first table:
>>
>> #+NAME: 2016-01-19-srctbl
>> | Testdata |
>>
>> |----------|
>> | foobar |
>> | fooübar |
>> | fooßbar |
>> | 1er |
>> | 23,42 |
>> | 23.42 |
>>
>> | Result | Expected Result | Comparison |
>> |----------+-----------------+----------------|
>> | foobar | foobar | OK |
>> | #ERROR | fooübar | fail |
>> | #ERROR | fooßbar | fail |
>> | er | 1er | fail |
>> | 23.42 | 23.42 | OK |
>> | (23, 42) | 23,42 | probably fail? |
>>
>> #+TBLFM: $1=remote(2016-01-19-srctbl,@@#$1)
>>
>> Thanks for clearing things up!
>
> I cannot get this to work either but I do think you want to enclose the
> remote() within (identity) to copy values and not try to evaluate an
> expression, as noted in the info page:
>
> $1=(identity remote(2016-01-19-srctbl,@@#$1))
>
> Also, I don't think you want an indirection using #.
>
> But I cannot get this to work so I could be completely off base...
You are missing a quote:
#+TBLFM: $1='(identity remote(2016-01-19-srctbl,@@#$1))
works for me.
Org-mode version 8.3.3 (release_8.3.3-456-g164555)
--
Nick
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Tables: remote reference fails with umlaut (and in other cases)
2016-01-19 15:29 ` Karl Voit
@ 2016-01-19 19:04 ` Michael Brand
2016-01-25 14:48 ` Karl Voit
0 siblings, 1 reply; 10+ messages in thread
From: Michael Brand @ 2016-01-19 19:04 UTC (permalink / raw)
To: Karl Voit; +Cc: Org Mode
Hi Karl
On Tue, Jan 19, 2016 at 4:29 PM, Karl Voit <devnull@karl-voit.at> wrote:
> I never understood the @@#-syntax anyway. On [1] I referenced to [2].
Please see the Org manual for @# and $#. Thus @@#$1 is substituted
with @1$1, @2$1, @3$1 etc. depending on the row it is evaluated on.
@1$$# becomes @1$1, @1$2 etc.
> [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?
Michael
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Tables: remote reference fails with umlaut (and in other cases)
2016-01-19 16:40 ` Nick Dokos
@ 2016-01-19 22:28 ` Stefan Huchler
2016-01-20 12:01 ` Karl Voit
1 sibling, 0 replies; 10+ messages in thread
From: Stefan Huchler @ 2016-01-19 22:28 UTC (permalink / raw)
To: emacs-orgmode
Nick Dokos <ndokos@gmail.com> writes:
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
> You are missing a quote:
>
> #+TBLFM: $1='(identity remote(2016-01-19-srctbl,@@#$1))
>
> works for me.
>
> Org-mode version 8.3.3 (release_8.3.3-456-g164555)
>
> --
> Nick
Wow,
that was an eye opener for me, first it lets me use/refer to german
umlauts, second I can use by this method full power of elisp on the
data:
#+TBLFM: $3='(nth 1 (split-string remote(addresstable, @@#$6) "@"))
extracts the hostname from a mail adress foo@bar.com -> bar.com.
it maybe makes even some kind of table data joining possible, failed
there on a tea-shopping database I tried to do in the past.
so thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Tables: remote reference fails with umlaut (and in other cases)
2016-01-19 16:40 ` Nick Dokos
2016-01-19 22:28 ` Stefan Huchler
@ 2016-01-20 12:01 ` Karl Voit
1 sibling, 0 replies; 10+ messages in thread
From: Karl Voit @ 2016-01-20 12:01 UTC (permalink / raw)
To: emacs-orgmode
* Nick Dokos <ndokos@gmail.com> wrote:
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> On Tuesday, 19 Jan 2016 at 14:10, Karl Voit wrote:
>>>
>>> #+NAME: 2016-01-19-srctbl
>>> | Testdata |
>>>
>>> |----------|
>>> | foobar |
>>> | fooübar |
>>> | fooßbar |
>>> | 1er |
>>> | 23,42 |
>>> | 23.42 |
>>>
>>> | Result | Expected Result | Comparison |
>>> |----------+-----------------+----------------|
>>> | foobar | foobar | OK |
>>> | #ERROR | fooübar | fail |
>>> | #ERROR | fooßbar | fail |
>>> | er | 1er | fail |
>>> | 23.42 | 23.42 | OK |
>>> | (23, 42) | 23,42 | probably fail? |
>>> #+TBLFM: $1=remote(2016-01-19-srctbl,@@#$1)
>
> You are missing a quote:
> #+TBLFM: $1='(identity remote(2016-01-19-srctbl,@@#$1))
> works for me.
And this works for me as well.
Thank you very much for your help!
--
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
> get Memacs from https://github.com/novoid/Memacs <
https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Tables: remote reference fails with umlaut (and in other cases)
2016-01-19 19:04 ` Michael Brand
@ 2016-01-25 14:48 ` Karl Voit
2016-01-25 17:57 ` Michael Brand
0 siblings, 1 reply; 10+ messages in thread
From: Karl Voit @ 2016-01-25 14:48 UTC (permalink / raw)
To: emacs-orgmode
* Michael Brand <michael.ch.brand@gmail.com> wrote:
> Hi Karl
Hi!
> On Tue, Jan 19, 2016 at 4:29 PM, Karl Voit <devnull@karl-voit.at> wrote:
>
>> I never understood the @@#-syntax anyway. On [1] I referenced to [2].
>
> Please see the Org manual for @# and $#. Thus @@#$1 is substituted
> with @1$1, @2$1, @3$1 etc. depending on the row it is evaluated on.
> @1$$# becomes @1$1, @1$2 etc.
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?
>> [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!
--
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
> get Memacs from https://github.com/novoid/Memacs <
https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Tables: remote reference fails with umlaut (and in other cases)
2016-01-25 14:48 ` Karl Voit
@ 2016-01-25 17:57 ` Michael Brand
0 siblings, 0 replies; 10+ messages in thread
From: Michael Brand @ 2016-01-25 17:57 UTC (permalink / raw)
To: Karl Voit; +Cc: Org Mode
[-- Attachment #1: Type: text/plain, Size: 2044 bytes --]
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
[-- Attachment #2: row-based.diff --]
[-- Type: text/plain, Size: 1904 bytes --]
diff --git a/featureshow/org-mode-teaser.org b/featureshow/org-mode-teaser.org
index 1d4305a..0d949ca 100644
--- a/featureshow/org-mode-teaser.org
+++ b/featureshow/org-mode-teaser.org
@@ -735,24 +735,24 @@ The formular can be simplified even more by using a column formula:
#+NAME: comparison-table-horizontal
| | Joe | Alice | Bob | sum |
-| 2012 Income June | 10 | 24 | 17 | 51 |
+| Income June 2012 | 10 | 24 | 17 | 51 |
| plus 20 percent | 12.0 | 28.8 | 20.4 | 60.0 |
| June 2013 | 11 | 31 | 21 | |
| Difference | -1.0 | 2.2 | 0.6 | 1.8 |
-#+TBLFM: @>$>=vsum(@5$2..@5$4)::@1$2..@1$4=remote(Income2012h, @1$$#)::@2=remote(Income2012h, @3$$#)::@3$2..@3$4=1.2 * remote(Income2012h, @3$$#);%.1f::@5$2..@5$4=@4-@3;%.1f
+#+TBLFM: @>$>=vsum(@5$2..@5$4)::@1$2..@1$4='(identity remote(Income2012h, @1$$#))::@2='(identity remote(Income2012h, @3$$#))::@3$2..@3$4=1.2 * remote(Income2012h, @3$$#);%.1f::@5$2..@5$4=@4-@3;%.1f
- all formulas explained in detail:
- ~@>$>=vsum(@5$2..@5$4)~
- value: ~1.8~
- last column in last row (~@>$>~) is the vector-sum (~vsum~) of
column two to four of fifth row (~@5$2..@5$4~)
- - ~@1$2..@1$4=remote(Income2012h, @1$$#)~
+ - ~@1$2..@1$4='(identity remote(Income2012h, @1$$#))~
- values: ~Joe | Alice | Bob | sum~
- column two to four of first row (~@1$2..@1$4~) are copied from
the corresponding fields of the first row (~@1$$#~) of table
"Income2012h"
- see also [[http://orgmode.org/worg/org-hacks.html#field-coordinates-in-formulas][Org-hacks]] for field formulas
- - ~@2=remote(Income2012h, @3$$#)~
+ - ~@2='(identity remote(Income2012h, @3$$#))~
- values: ~2012 Income June | 10 | 24 | 17 | 51~
- the second row (~@2~) is copied from the corresponding fields of
the first row (~@1$$#~) of table "Income2012h"
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-01-25 17:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-19 13:10 Tables: remote reference fails with umlaut (and in other cases) Karl Voit
2016-01-19 15:12 ` Eric S Fraga
2016-01-19 15:29 ` Karl Voit
2016-01-19 19:04 ` Michael Brand
2016-01-25 14:48 ` Karl Voit
2016-01-25 17:57 ` Michael Brand
2016-01-19 16:40 ` Nick Dokos
2016-01-19 22:28 ` Stefan Huchler
2016-01-20 12:01 ` Karl Voit
2016-01-19 16:32 ` Stefan Huchler
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).