emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] help for summing column when exporting table


From: Charles Millar
Subject: [O] help for summing column when exporting table
Date: Fri, 19 Jun 2015 08:36:35 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]