Why does my code generate the error when used with org-table?
No error message when code used outside of org-table
#+NAME: get-country-or-area-name
#+HEADER: :var iso-alpha2-code="ca"
#+HEADER: :var dc-list='((US . "United States of America") (CA . "Canada") (BR . "Brazil"))
#+BEGIN_SRC elisp
(setq s (upcase (substring iso-alpha2-code 0 2)))
(cdr (assoc-string `,s dc-list))
#+END_SRC
#+NAME: Brazil
#+CALL: get-country-or-area-name(iso-alpha2-code="br")
#+RESULTS: Brazil
: Brazil
#+NAME: Canada
#+CALL: get-country-or-area-name(iso-alpha2-code="ca")
#+RESULTS: Canada
: Canada
#+NAME: United-States-of-America
#+CALL: get-country-or-area-name(iso-alpha2-code="us")
#+RESULTS: United-States-of-America
: United States of America
Error generated when called in #+TBLFM:
The error is generated when org-table-calc-current-TBLFM
attempts to delete the temporary #+TBLFM:
line.
Before:
| ISO Alpha 2 Code | Country or Area Name |
|------------------+--------------------------|
| BR | |
| CA | |
| US | |
#+TBLFM: $2='(org-sbe get-country-or-area-name (iso-alpha2-code $$1))
After:
| ISO Alpha 2 Code | Country or Area Name |
|------------------+--------------------------|
| BR | Brazil |
| CA | Canada |
| US | United States of America |
#+TBLFM: $2='(org-sbe get-country-or-area-name (iso-alpha2-code $$1))
#+TBLFM: $2='(org-sbe get-country-or-area-name (iso-alpha2-code $$1))
Excerpt from *Messages*
buffer:
Re-applying formulas to 3 lines… done
Re-applying formulas… done
org-table-calc-current-TBLFM: Wrong type argument: integer-or-marker-p, "US"
Thanks for your help!!
Version Info
org-mode version: 8.3.5
emacs version: GNU Emacs 24.5.1 (x86_64-unknown-cygwin, GTK+ Version 3.14.13)