emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Olivier Schwander <olivier.schwander@chadok.info>
To: emacs-orgmode@gnu.org
Subject: Re: clocktable display format
Date: Mon, 29 Mar 2010 12:21:09 +0200	[thread overview]
Message-ID: <20100329102109.GC16011@pomerol.lix.polytechnique.fr> (raw)
In-Reply-To: <20100326163129.GA16011@pomerol.lix.polytechnique.fr>

Le 26 Mar 2010 17:31, Olivier Schwander a écrit:
> Hello,
> 
> I am using clocktable to display a summary of the effort in a subtree.
> As I am not particularly interested in precise hourly details, I would
> like to display the total time in days instead of hours.
> 
> Now I have:
> | L | Headline              | Time     |        |
> |---+-----------------------+----------+--------|
> |   | *Total time*          | *528:00* |        |
> 
> and I would like:
> | L | Headline              | Time     |        |
> |---+-----------------------+----------+--------|
> |   | *Total time*          | *22*     |        |
> 
> I tried to add a formula in the table, but it doesn't work since the
> fields are in the format hour:minute. I suppose I could use org-babel to
> parse the content of the field and convert it into days but it seems
> rather complicated and I would be happy with a simple solution. Any
> ideas ?

I am replying to myself in order to explain my solution. As it does not
seem to be possible to change the display format, I simply added an
elisp formula in the table (thanks to Carsten who suggested not to use
babel). The difficulty was to parse the content of the field since it's
not a number but a string with a colon in the middle.

#+BEGIN: clocktable :maxlevel 2 :scope subtree
Clock summary at [2010-03-26 ven. 17:56]

| L | Headline              | Time     |           |
|---+-----------------------+----------+-----------|
|   | *Total time*          | *528:00* | *22 days* |
|---+-----------------------+----------+-----------|
| 1 | All                   | 528:00   |           |
| 2 | Event A               |          |     72:00 |
| 2 | Event B               |          |     96:00 |
| 2 | Event C               |          |    120:00 |
| 2 | Event D               |          |    120:00 |
| 2 | Event E               |          |    120:00 |
#+TBLFM: @2$4='(concat "*" (number-to-string (/ (string-to-number (if (string-match "\\(.+\\):.+" @3$3) (match-string 1 @3$3))) 24)) " days*")
#+END:

Notice that the formula is kept when updating the clocktable, so it's
very easy to use.

I really needed this since I had to know the number of days spent to
theses events (the duration of a trip is naturally in days, not in
hours). I am not sure if this tips has a real interest for work, but I
can add it if you ask.

Cheers,

Olivier

      parent reply	other threads:[~2010-03-29 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26 16:31 clocktable display format Olivier Schwander
2010-03-26 22:18 ` Carsten Dominik
2010-03-29 10:21 ` Olivier Schwander [this message]

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=20100329102109.GC16011@pomerol.lix.polytechnique.fr \
    --to=olivier.schwander@chadok.info \
    --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).