emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* help for summing column when exporting table
@ 2015-06-19 12:36 Charles Millar
  0 siblings, 0 replies; only message in thread
From: Charles Millar @ 2015-06-19 12:36 UTC (permalink / raw)
  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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-19 12:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-19 12:36 help for summing column when exporting table Charles Millar

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).