emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Table formula not returning an error
@ 2011-10-06 14:21 Sebastien Vauban
  2011-10-07  9:09 ` Lawrence Mitchell
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastien Vauban @ 2011-10-06 14:21 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

I was surprised by how 10 minutes was converted to 0.02 hour in a table:

| Tâche      | HH:MM | Frac |
|------------+-------+------|
| Avril 2011 | 0:1O  | 0.02 |
|------------+-------+------|
|            |       | 0.02 |
#+TBLFM: $3='(/ (float (org-hh:mm-string-to-minutes $2)) 60.);%.2f::@3$3=vsum(@-I..@-II)

I took me less than 2 minutes to discover the problem -- wanna play the
"1 diff game" (in the table itself, not in the formula)? -- and fix it:

| Tâche      | HH:MM | Frac |
|------------+-------+------|
| Avril 2011 |  0:10 | 0.17 |
|------------+-------+------|
|            |       | 0.17 |
#+TBLFM: $3='(/ (float (org-hh:mm-string-to-minutes $2)) 60.);%.2f::@3$3=vsum(@-I..@-II)

But I'm surprised I did not see any error reported.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Table formula not returning an error
  2011-10-06 14:21 Table formula not returning an error Sebastien Vauban
@ 2011-10-07  9:09 ` Lawrence Mitchell
  0 siblings, 0 replies; 2+ messages in thread
From: Lawrence Mitchell @ 2011-10-07  9:09 UTC (permalink / raw)
  To: emacs-orgmode

Sebastien Vauban wrote:

[...]

> But I'm surprised I did not see any error reported.

This is a feature of org-hh:mm-string-to-minutes:

| Convert a string H:MM to a number of minutes.
| If the string is just a number, interpret it as minutes.
| In fact, the first hh:mm or number in the string will be taken,
| there can be extra stuff in the string.
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| If no number is found, the return value is 0.

It's arguable that this is the best choice, but it is one.

Lawrence
-- 
Lawrence Mitchell <wence@gmx.li>

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

end of thread, other threads:[~2011-10-07  9:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-06 14:21 Table formula not returning an error Sebastien Vauban
2011-10-07  9:09 ` Lawrence Mitchell

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