From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Schwander Subject: Re: clocktable display format Date: Mon, 29 Mar 2010 12:21:09 +0200 Message-ID: <20100329102109.GC16011@pomerol.lix.polytechnique.fr> References: <20100326163129.GA16011@pomerol.lix.polytechnique.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NwC5t-0001CX-QZ for emacs-orgmode@gnu.org; Mon, 29 Mar 2010 06:21:17 -0400 Received: from [140.186.70.92] (port=39785 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwC5r-0001CO-Ku for emacs-orgmode@gnu.org; Mon, 29 Mar 2010 06:21:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NwC5q-0000XB-2L for emacs-orgmode@gnu.org; Mon, 29 Mar 2010 06:21:15 -0400 Received: from mx-a.polytechnique.fr ([129.104.30.14]:39373) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NwC5p-0000WU-Qp for emacs-orgmode@gnu.org; Mon, 29 Mar 2010 06:21:14 -0400 Received: from argos.lix.polytechnique.fr (argos.lix.polytechnique.fr [129.104.11.2]) by mx-a.polytechnique.fr (tbp 5.3.2/2.0.7) with ESMTP id o2TAL9jB024980 for ; Mon, 29 Mar 2010 12:21:09 +0200 Received: from mailhost.lix.polytechnique.fr (pomerol.lix.polytechnique.fr [129.104.11.158]) by argos.lix.polytechnique.fr (Postfix) with ESMTP id 57C13F5A6D for ; Mon, 29 Mar 2010 12:21:09 +0200 (CEST) Received: (from schwander@localhost) by mailhost.lix.polytechnique.fr (8.14.3/8.12.8/Submit) id o2TAL9Ff011093 for emacs-orgmode@gnu.org; Mon, 29 Mar 2010 12:21:09 +0200 Content-Disposition: inline In-Reply-To: <20100326163129.GA16011@pomerol.lix.polytechnique.fr> 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 Le 26 Mar 2010 17:31, Olivier Schwander a =E9crit: > Hello, >=20 > 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. >=20 > Now I have: > | L | Headline | Time | | > |---+-----------------------+----------+--------| > | | *Total time* | *528:00* | | >=20 > and I would like: > | L | Headline | Time | | > |---+-----------------------+----------+--------| > | | *Total time* | *22* | | >=20 > 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 t= o > 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=3D'(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