* combining a source code block and TBLFM
[not found] <1184136243.2122892.1529944889342.ref@mail.yahoo.com>
@ 2018-06-25 16:41 ` Brad Knotwell
0 siblings, 0 replies; only message in thread
From: Brad Knotwell @ 2018-06-25 16:41 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]
Good day all--
Beyond outputting raw orgmode text, is there a way to do the following:
* take the table output of a source block* apply a TBLFM operation on it
I have a contrived example below:
#+name: x| a | 3 | 4 | 5 || b | 6 | 8 | 10 |
#+begin_src python :var x=x :results value tablex[0].append('')x[1].append('')x.insert(0,['Item','x','y','z','Total'])x.insert(1,None)x.append(None)x.append(['Total','','','',''])x.append(None)x.insert(0,None)return x#+end_src
#+RESULTS:|-------+---+---+----+-------|| Item | x | y | z | Total ||-------+---+---+----+-------|| a | 3 | 4 | 5 | || b | 6 | 8 | 10 | ||-------+---+---+----+-------|| Total | | | | ||-------+---+---+----+-------|
I would like the following formula to be applied:
#+TBLFM: @>$2=vsum(@2$2..@-1$2)::@>$3=vsum(@2$3..@-1$3)::@>$4=vsum(@2$4..@-1$4)::$5=$2+$3+$4
but I can't figure out how to keep the evaluation from overwriting the #+TBLFM: line. While I realize I could just sum everything up in the python code (preferred) or return raw org-mode data (ugly), it occurred to me that there might be an elegant way to do this.
Thx.
--Brad
Thx.
--Brad
[-- Attachment #2: Type: text/html, Size: 2156 bytes --]
^ permalink raw reply [flat|nested] only message in thread