emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Sub-totals
Date: Wed, 19 Feb 2014 07:54:24 -0500	[thread overview]
Message-ID: <87r46zclfj.fsf@gmail.com> (raw)
In-Reply-To: CAG-LmmA4r=m+cY_YhgiJjoFYnEgdbv_PiyteM8M+dBjFfzrY8w@mail.gmail.com

Cecil Westerhof <cldwesterhof@gmail.com> writes:

> 2014-02-16 10:06 GMT+01:00 Michael Brand <michael.ch.brand@gmail.com>:
>
>     > - I would like to have only the last element of the range filled.
>    
>     I always thought that this would not be possible with reasonable
>     effort. Your question made me think again and it is possible, now I
>     can change my own use cases with sub-total :-) . See docstring and
>     take the procedure with vlen etc. from the TBLFM of the new ERT
>     test-org-table/sub-total here:
>     http://orgmode.org/w/org-mode.git?p=org-mode.git;a=blob;f=testing/lisp/test-org-table.el
>    
>     Or read the docstring there and just take this copy that I used to
>     build the ERT:
>     |-------+-------+-------|
>     | Item  |  Item |  Sub- |
>     | name  | value | total |
>     |-------+-------+-------|
>     | a1    |   4.1 |       |
>     | a2    |   8.2 |       |
>     | a3    |       |  12.3 |
>     |-------+-------+-------|
>     | b1    |  16.0 |  16.0 |
>     |-------+-------+-------|
>     | c1    |    32 |       |
>     | c2    |    64 |  96.0 |
>     |-------+-------+-------|
>     | Total | 124.3 |       |
>     |-------+-------+-------|
>     #+TBLFM: @>$2 = vsum(@II..@>>) :: $3 = if(vlen(@-I$2..@0$2) ==
>     vlen(@-I$2..@+I$2), vsum(@-I$2..@+I$2) +.0, string("")); EN f-1 ::
>     @>$3 = string("")
>
> I made:
>     #+TBLFM: @>$2 = vsum(@<<..@>>) :: @<<$3..@>>$3 = if(vlen(@-I$2..@0$2) == vlen(@-I$2..@+I$2), vsum(@-I$2..@+I$2), string(""))
>

Nice! Worth a mention in the org-hacks section on Worg I think.

-- 
Nick

  reply	other threads:[~2014-02-19 12:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-15 14:27 Sub-totals Cecil Westerhof
2014-02-15 15:19 ` Sub-totals Michael Brand
2014-02-15 17:14   ` Sub-totals Cecil Westerhof
2014-02-15 17:31     ` Sub-totals Cecil Westerhof
2014-02-16  9:06     ` Sub-totals Michael Brand
2014-02-19  5:00       ` Sub-totals Cecil Westerhof
2014-02-19 12:54         ` Nick Dokos [this message]
2014-02-19 19:39           ` Sub-totals Michael Brand
2014-02-20  7:55       ` Sub-totals Michael Brand

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=87r46zclfj.fsf@gmail.com \
    --to=ndokos@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

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