emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] clocktable display format


From: Olivier Schwander
Subject: Re: [Orgmode] clocktable display format
Date: Mon, 29 Mar 2010 12:21:09 +0200
User-agent: Mutt/1.5.20 (2009-08-17)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]