[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: remote calls to tables and (empty entry, NAN)
From: |
Uwe Brauer |
Subject: |
Re: remote calls to tables and (empty entry, NAN) |
Date: |
Fri, 07 Jun 2024 22:52:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Hi again
> Uwe Brauer <oub@mat.ucm.es> writes:
> This works for me:
> #+TBLFM: $2=if(typeof(remote(table2, @@#$7)) == 12, string(""),
> remote(table2, @@#$7)); E
I just realized that the @@#$7 is not save against errors
#+begin_src
* Simple remote
#+Name: table1
| Name | Ex1 | Ex2 | Ex2 | Ex4 | Ex5 | ResSh1 |
|--------+-----+-----+-----+-----+-----+--------|
| Smith | 2 | 3 | 4 | 6 | 7 | |
| Miller | 2 | 10 | 1 | 1 | 5 | 19 |
| Wick | 1 | 2 | 3 | 10 | 2 | 18 |
#+TBLFM: $7=vsum($2..$6);f2
#+Name: table2
| Name | Ex1 | Ex2 | Ex2 | Ex4 | Ex5 | ResSh2 |
|--------+-----+-----+-----+-----+-----+--------|
| Miller | 9 | 4 | 6 | 9 | 3 | 31 |
| Smith | 8 | 3 | 5 | 8 | 9 | 33 |
| Wick | 1 | 5 | 9 | 1 | 2 | 18 |
|--------+-----+-----+-----+-----+-----+--------|
#+TBLFM: $7=vsum($2..$6);f2
#+Name: final
| Name | ResSh1 | ResSh2 |
|--------+--------+--------|
| Smith | | 31 |
| Miller | 19 | 33 |
| Wick | 18 | 18 |
|--------+--------+--------|
#+TBLFM: $2=if(typeof(remote(table1, @@#$7)) == 12, string(""), remote(table1,
@@#$7)); E::$3=remote(table2,@@#$7)
#+end_src
As you can see in the table2 the row Miller-and-Smith have been
interchanged and so the final table ends up with incorrect values
However, (as somebody else suggested some time ago) the following
solution avoids that problem.
#+begin_src
#+NAME: table3
| Name | Ex1 | Ex2 | Ex2 | Ex4 | Ex5 | ResSh1 |
|--------+-----+-----+-----+-----+-----+--------|
| Smith | 2 | 3 | 4 | 6 | 7 | 22 |
| Miller | 2 | 10 | 1 | 1 | 5 | 19 |
| Wick | 1 | 2 | 3 | 10 | 2 | 18 |
#+TBLFM: $7=vsum($2..$6);f2
#+NAME: table4
| Name | Ex1 | Ex2 | Ex2 | Ex4 | Ex5 | ResSh2 |
|--------+-----+-----+-----+-----+-----+--------|
| Miller | 2 | 1 | 6 | 9 | 3 | 21 |
| Smith | 8 | 3 | 5 | 8 | 9 | 33 |
| Wick | 1 | 5 | 9 | 1 | 2 | 18 |
#+TBLFM: $7=vsum($2..$6);f2
#+Name: final
| Name | ResSh1 | ResSh2 | Total |
|--------+--------+--------+-------|
| Smith | 22 | 33 | |
| Miller | 19 | 21 | |
| Wick | 18 | 18 | |
#+TBLFM: $2='(org-lookup-first $1 '(remote(table3, @1$1..@4$1))
'(remote(table3, @1$7..@4$7)))::$3='(org-lookup-first $1 '(remote(table4,
@1$1..@4$1)) '(remote(table4, @1$7..@4$7)))
#+end_src
But I don't know you use use typeof in that case
Any ideas?
#+TBLFM: $2='(org-lookup-first $1 '(remote(table3, @1$1..@4$1))
if(typeof('(remote(table3, @1$7..@4$7))) == 12, string(""),(remote(table3,
@1$7..@4$7))); E
Does not work
Uwe Brauer
smime.p7s
Description: S/MIME cryptographic signature