emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bart Bunting <bart@bunting.net.au>
To: emacs-orgmode@gnu.org
Subject: Babel: help with tables and code blocks?
Date: Sun, 08 Aug 2010 18:03:28 +1000	[thread overview]
Message-ID: <878w4hcyzz.fsf@bunting.net.au> (raw)

Hi everyone,

I'm trying to get my head around babel and getting info back into a

The below org file tracks expenses and the perl code simply sums them

The code is working but I now want to get the total back into another table.  What I have is not
working can someone tell me what I'm doing wrong here?



* Expenses

#+tblname: expenses
|       Date | What                              | Amount |
| 2010-07-26 | Breakfast                         |      5 |
| 2010-07-26 | groceries                         |    8.5 |
| 2010-07-26 | butchers - chicken                |    5.5 |
| 2010-07-27 | umart - video card, kvm, speakers |    136 |

* Code

#+srcname: totals 
#+begin_src perl  :var details=expenses[1:-1]
  my $total = 0;
  foreach my $row  (@$details) {
      $total += @$row[2];
return $total;

#+results: totals
: 155

* Totals

| Total | #ERROR |
  #+TBLFM: $2=#+call: totals(details=expenses)

             reply	other threads:[~2010-08-08 16:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-08  8:03 Bart Bunting [this message]
2010-08-08 19:34 ` Babel: help with tables and code blocks? Dan Davison
2010-08-08 22:20   ` Bart Bunting
2010-08-08 22:38     ` Dan Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878w4hcyzz.fsf@bunting.net.au \
    --to=bart@bunting.net.au \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).