Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-25 Thread Karl Voit
* Michael Brand  wrote:
> Hi Karl

Hi!

> On Tue, Jan 19, 2016 at 4:29 PM, Karl Voit  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




Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-25 Thread Michael Brand
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
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"


Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-20 Thread Karl Voit
* Nick Dokos  wrote:
> Eric S Fraga  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




Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-19 Thread Stefan Huchler
Nick Dokos  writes:

> Eric S Fraga  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 f...@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.




Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-19 Thread Michael Brand
Hi Karl

On Tue, Jan 19, 2016 at 4:29 PM, Karl Voit  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



Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-19 Thread Eric S Fraga
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



Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-19 Thread Karl Voit
Hi Eric,

* Eric S Fraga  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




Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-19 Thread Nick Dokos
Eric S Fraga  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




Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-19 Thread Stefan Huchler
Karl Voit  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.