Richard Sent <rich...@freakingpenguin.com> writes:

> When using org-table-get-remote-range to retrieve a field, I find that
> my return value changes depending on if I'm accessing the field via a
> row-column reference or a field-name reference.
>
> Here's an example:
> ...
> #+RESULTS:
> : Type: string
> : Value: 42
>
> When using a field name, the result is still returned as a string but
> is now enclosed in ().
>
> #+begin_src emacs-lisp
>   (let ((res (org-table-get-remote-range "tbl/foo" "$myfoo")))
>       (format "Type: %s\nValue: %s" (type-of res) res))
> #+end_src
>
> #+RESULTS:
> : Type: string
> : Value: (42)

Confirmed.

> Why when I use the field name is my result enclosed in ()?
> org-table-get-remote-range is smart enough to recognize I'm returning a
> single value, hence the type being string and not cons. Is this a bug in
> Org or a failure in my understanding?

Looks like a bug.
On the other hand, what you get appears to be deliberate - parenthesis
are explicitly added in `org-table-formula-substitute-names'.
So, I am not sure what is going to happen if we drop the parenthesis
(the tests are not broken, but who knows).
I am not even sure what is their purpose.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to