emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Table formula referencing cells with HH:MM time strings, incorrect result
@ 2009-09-25 18:41 Jeff Kowalczyk
  2009-09-28  7:13 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Kowalczyk @ 2009-09-25 18:41 UTC (permalink / raw)
  To: emacs-orgmode

I am trying to use HH:MM time strings from clocktables in a table formula. First
time I've used table formulas, BTW.

When fetching the cells as remote(), I got strange results. The behavior is the
same for regular references, so here's a regular-reference test case:

| 17:36 | 17:36 |
| 19:45 | 19:45 |
| 24:53 | 24:53 |
| 40:57 | 40:57 |
| 43:02 |  43:2 |
| 45:14 | 45:14 |
| 46:09 |  46:9 |
| 48:56 |   6:7 |
| 49:28 |   7:4 |
| 55:18 | 55:18 |
| 80:10 |     8 |
| 88:14 |  44:7 |
#+TBLFM: $2=$1

The objective is to multiply time (decimal) by a constant, so if anyone has a
tip for parsing HH:MM using a function instead of reinventing, thanks in advance.

Thanks,
Jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Table formula referencing cells with HH:MM time strings, incorrect result
  2009-09-25 18:41 Table formula referencing cells with HH:MM time strings, incorrect result Jeff Kowalczyk
@ 2009-09-28  7:13 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-09-28  7:13 UTC (permalink / raw)
  To: Jeff Kowalczyk; +Cc: emacs-orgmode


On Sep 25, 2009, at 7:41 PM, Jeff Kowalczyk wrote:

> I am trying to use HH:MM time strings from clocktables in a table  
> formula. First
> time I've used table formulas, BTW.
>
> When fetching the cells as remote(), I got strange results. The  
> behavior is the
> same for regular references, so here's a regular-reference test case:
>
> | 17:36 | 17:36 |
> | 19:45 | 19:45 |
> | 24:53 | 24:53 |
> | 40:57 | 40:57 |
> | 43:02 |  43:2 |
> | 45:14 | 45:14 |
> | 46:09 |  46:9 |
> | 48:56 |   6:7 |
> | 49:28 |   7:4 |
> | 55:18 | 55:18 |
> | 80:10 |     8 |
> | 88:14 |  44:7 |
> #+TBLFM: $2=$1
>
> The objective is to multiply time (decimal) by a constant, so if  
> anyone has a
> tip for parsing HH:MM using a function instead of reinventing,  
> thanks in advance.

HH:MM is interpreted by calc a integer division.  For example 80/10 = 8
and 49/28=7/4

I think for this kind of stuff you need to work with Emacs lisp  
formulas,
for example

#+TBLFM: $2='(/ (float (org-hh:mm-string-to-minutes $1)) 60.);%.2f


HTH

- Carsten



>
> Thanks,
> Jeff
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-28  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-25 18:41 Table formula referencing cells with HH:MM time strings, incorrect result Jeff Kowalczyk
2009-09-28  7:13 ` Carsten Dominik

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