From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brad Knotwell Subject: combining a source code block and TBLFM Date: Mon, 25 Jun 2018 16:41:29 +0000 (UTC) Message-ID: <1184136243.2122892.1529944889342@mail.yahoo.com> References: <1184136243.2122892.1529944889342.ref@mail.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2122891_95912206.1529944889339" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXUYc-0002ZK-32 for emacs-orgmode@gnu.org; Mon, 25 Jun 2018 12:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXUYY-00087e-2A for emacs-orgmode@gnu.org; Mon, 25 Jun 2018 12:41:38 -0400 Received: from sonic317-20.consmr.mail.gq1.yahoo.com ([98.137.66.146]:46654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXUYX-00087P-N4 for emacs-orgmode@gnu.org; Mon, 25 Jun 2018 12:41:33 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "emacs-orgmode@gnu.org" ------=_Part_2122891_95912206.1529944889339 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 |=C2=A0 5 || b | 6 | 8 | 10 | #+begin_src python :var x=3Dx :results value tablex[0].append('')x[1].appen= d('')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=C2=A0 | x | y |=C2=A0 z | To= tal ||-------+---+---+----+-------|| a=C2=A0 =C2=A0 =C2=A0| 3 | 4 |=C2=A0 5= |=C2=A0 =C2=A0 =C2=A0 =C2=A0|| b=C2=A0 =C2=A0 =C2=A0| 6 | 8 | 10 |=C2=A0 = =C2=A0 =C2=A0 =C2=A0||-------+---+---+----+-------|| Total |=C2=A0 =C2=A0|= =C2=A0 =C2=A0|=C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0||-------+---+---+-= ---+-------| I would like the following formula to be applied: #+TBLFM: @>$2=3Dvsum(@2$2..@-1$2)::@>$3=3Dvsum(@2$3..@-1$3)::@>$4=3Dvsum(@2= $4..@-1$4)::$5=3D$2+$3+$4 but I can't figure out how to keep the evaluation from overwriting the #+TB= LFM: line.=C2=A0 While I realize I could just sum everything up in the pyth= on code (preferred) or return raw org-mode data (ugly), it occurred to me t= hat there might be an elegant way to do this. Thx. --Brad Thx. --Brad ------=_Part_2122891_95912206.1529944889339 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Good day all--

Beyond outputting raw orgmode text, is there a way to do the follow= ing:

* take the table output of a source block
* apply a TBLFM operation on it

I have a co= ntrived example below:

#+name: x
<= div>| a | 3 | 4 |  5 |
| b | 6 | 8 | 10 |

#+begin_src python :var x=3Dx :results value table
x[0].ap= pend('')
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:
|-------+---+---+----+-------|
| It= em  | x | y |  z | Total |
|-------+---+---+----+------= -|
| a     | 3 | 4 |  5 |     =  |
| b     | 6 | 8 | 10 |     = ;  |
|-------+---+---+----+-------|
| Total | = ;  |   |    |       |
|-------+---+---+----+-------|

I would like th= e following formula to be applied:

#+TBLFM: @&= gt;$2=3Dvsum(@2$2..@-1$2)::@>$3=3Dvsum(@2$3..@-1$3)::@>$4=3Dvsum(@2$4= ..@-1$4)::$5=3D$2+$3+$4

but I can't figure out how= to keep the evaluation from overwriting the #+TBLFM: line.  While I r= ealize I could just sum everything up in the python code (preferred) or ret= urn raw org-mode data (ugly), it occurred to me that there might be an eleg= ant way to do this.

Thx.

--Brad



Thx.
<= div>
--Brad
------=_Part_2122891_95912206.1529944889339--