From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Millar Subject: help for summing column when exporting table Date: Fri, 19 Jun 2015 08:36:35 -0400 Message-ID: <55840CD3.5030206@verizon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5vXj-0005Ld-Mm for emacs-orgmode@gnu.org; Fri, 19 Jun 2015 08:37:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5vXf-0007bT-JB for emacs-orgmode@gnu.org; Fri, 19 Jun 2015 08:37:11 -0400 Received: from vms173025pub.verizon.net ([206.46.173.25]:21402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5vXf-0007YQ-F3 for emacs-orgmode@gnu.org; Fri, 19 Jun 2015 08:37:07 -0400 Received: from [192.168.1.128] ([70.209.140.246]) by vms173025.mailsrvcs.net (Oracle Communications Messaging Server 7.0.5.32.0 64bit (built Jul 16 2014)) with ESMTPA id <0NQ600DS0Z14FEX0@vms173025.mailsrvcs.net> for emacs-orgmode@gnu.org; Fri, 19 Jun 2015 07:36:41 -0500 (CDT) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" How do you execute #+TBLFM: @>$>='(apply '+ '(@I$>..@>>$>));N%.2f while the following is being exported to LaTeX/pdf begin #+LATEX_CLASS: mysetup #+LaTeX: \setlength{\extrarowheight}{1.0ex} #+LaTeX: \begin{center} #+LaTeX: \textbf{SCHEDULE A}\\ #+LaTeX: \textbf{PRINCIPAL RECEIVED} #+LaTeX: \end{center} #+BEGIN_LaTeX \vspace{-10.0ex} #+END_LaTeX #+NAME: SCHEDA #+begin_src rec :data foo.rec :type Finance :fields AssetDate,Description,Basis AccountSchedule = "A" #+end_src #+ATTR_LATEX: :environment longtable :align p{60pt}p{315pt}N{8}{2} #+TBLNAME: SCHEDA #+TBLFM: @>$>='(apply '+ '(@I$>..@>>$>));N%.2f end the table is generated from a recutils file and there are approximately 16 other tables which are generated using essentially the same format (AccountSchedule= is different in each one), and some may be five or six columns rather than three. When I export to the pdf all the tables exported, except that the total is not executed before export. The SCHEDDA table, as shown in the .org file is #+NAME: SCHEDA #+begin_src rec :data foo.rec :type Finance :fields AssetDate,Description,Basis AccountSchedule = "A" #+end_src #+ATTR_LATEX: :environment longtable :align p{60pt}p{315pt}N{8}{2} #+TBLNAME: SCHEDA | AssetDate | Description | Basis | |----------------+----------------------+---------------| | 2015-12-15 | xxxx | 385162.27 | | 2015-12-15 | yyyyyyyyyyyyyy | 99962.29 | | 2015-12-15 | zzzzz | 108185.37 | | | Total | | #+TBLFM: @>$>='(apply '+ '(@I$>..@>>$>));N%.2f I believe that executing emacs lisp table formula (rather than the org-calc #+TBLFM: @>$>=vsum(@I$>..@>>$>);%.2f) may be the "way to go" and that a separate src block may be needed such as #+NAME: schedtotal #+begin_src emacs-lisp :results silent (defun schedtotal () (#+TBLFM: @>$>='(apply '+ '(@I$>..@>>$>));N%.2f)) #+end_src for execution using :post schedtotal in the header, so that once the table is generated the :post schedtotal will sum the last column and then the subtree will be exported with each table and its last column added. I am attempting to learn emacs lisp and I have tried the above schedtotal, but the # is a problem; if you remove that then the ; may be problem since everything after that is a comment. Any help as well as solution will be greatly appreciated. Charlie Millar