emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Calc/TBLFM: how to conditionally insert hours:minutes?


From: Chris Keschnat
Subject: Re: Calc/TBLFM: how to conditionally insert hours:minutes?
Date: Mon, 25 Sep 2023 19:36:53 +0200

Hi Bruno,

> You could switch to the "Lisp" syntax (as opposed to the "Calc" syntax),
> and, write the conversion manually:
>
>     | 19:55:00 |
>     | 40:01:00 |
>     | 40:01:00 |
>
>     #+TBLFM: $1='(org-table-time-string-to-seconds (if (<= @# 1) "19:55" 
> "40:01"));T

awesome, thank out. This works as expected with the little addendum that
@# in Calc seems to ignore the header line (not present in this
example), but the Lispy syntax doesn't. So the 1 in the "if" becomes a 2.

> Note that, for Calc, 'X:Y' means the fraction 'X/Y' of the two
> integers X and Y:
>
>    40:01 = 40/1 = 40
>    40:02 = 40/2 = 20
>    40:03 = 40/3
>    40:04 = 40/4 = 10

This also explains why 40:00 errors out :)

Thanks a lot

Chris



reply via email to

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