From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bart Bunting Subject: Babel: help with tables and code blocks? Date: Sun, 08 Aug 2010 18:03:28 +1000 Message-ID: <878w4hcyzz.fsf@bunting.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=50754 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oi95C-0001ib-1y for emacs-orgmode@gnu.org; Sun, 08 Aug 2010 12:50:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oi0r6-0002mN-VW for emacs-orgmode@gnu.org; Sun, 08 Aug 2010 04:03:42 -0400 Received: from cassowary.ursys.com.au ([203.7.149.14]:52154) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oi0r6-0002PJ-Jl for emacs-orgmode@gnu.org; Sun, 08 Aug 2010 04:03:40 -0400 Received: from cassowary.ursys.com.au ([203.7.149.14] helo=zig) by cassowary.ursys.com.au with esmtpa (Exim 4.50 #1 (Debian)) id 1Oi0qw-0003Ps-47 for ; Sun, 08 Aug 2010 18:03:30 +1000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi everyone, I'm trying to get my head around babel and getting info back into a table. The below org file tracks expenses and the perl code simply sums them up. 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? Cheers Bart * 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; #+end_src #+results: totals : 155 * Totals | Total | #ERROR | #+TBLFM: $2=#+call: totals(details=expenses)