- I would like to calculate some fields from an org-table filled with strings.
- There are many tables which all could share the same lisp-code.
- The lisp-code is rather complex and long.
- It should run for a single table multiple times, but with different parameters.
- I would like to share the org-document along with calculation-ability.
Is it possible to achive this? If so how to achieve this?
I have done some simple tests to show you where my problem is:
#+NAME: test3 #+BEGIN_SRC emacs-lisp :var x="foobar" (length x) #+END_SRC #+TBLNAME: test3-tbl | blahbar | | | testi | 7 | #+TBLFM: @2$2='(org-sbe test3 (x $@1$1))
The above code works it takes one string from the table and prints its length into the table, fine.
Next code is also working:
#+NAME: test5 #+BEGIN_SRC emacs-lisp :var x='(2 3) (* (car x) (cadr x)) #+END_SRC #+TBLNAME: test5-tbl | 4 | 5 | |---+----| | 6 | 20 | #+TBLFM: @>$1='(org-sbe test5)::@>$2='(org-sbe test5 (x @1$1..@1$2))
It takes a range of numbers from the table and does some calculation, fine.
Now I tried to combine the stuff from above, and there I hit the wall. How to give a range (fields @1$1 to @1$2) from test-tbl4 to code-block test4?
#+NAME: test4 #+BEGIN_SRC emacs-lisp :var x='("foobar" "barfoo") (concat (car x) (cadr x)) #+END_SRC #+TBLNAME: test4-tbl | blahbar | test | | foobarbarfoo | #ERROR | #+TBLFM: @>$1='(org-sbe test4)::@>$2='(org-sbe test4 (x $@1$1..$@1$2))
As you can see by
#ERROR it is not working.
So my Questions:
- How get table test4-tbl to work with code-block test4?
- And could you please point me to the documentation where this is described?