From: Bruno Barbier <brubar.cs@gmail.com>
To: Chris Keschnat <chris@catsu.it>, emacs-orgmode@gnu.org
Subject: Re: Calc/TBLFM: how to conditionally insert hours:minutes?
Date: Mon, 25 Sep 2023 11:32:18 +0200 [thread overview]
Message-ID: <651153a4.7b0a0220.f4676.c846@mx.google.com> (raw)
In-Reply-To: <87pm28llcu.fsf@catsu.it>
Hi Chris,
Chris Keschnat <chris@catsu.it> writes:
>
> | 19:55:00 |
> | 00:00:40 |
> | 00:00:40 |
> #+TBLFM: $1=if(@# <= 1, 19:55, 40:01);T
>
> What would be the correct way to do this?
>
It seems that org tries to convert times back and forth when evaluating
formulas; but, in your case, it cannot convert them because it doesn't
spot them inside your formula.
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
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
Bruno
next prev parent reply other threads:[~2023-09-25 9:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-23 19:38 Calc/TBLFM: how to conditionally insert hours:minutes? Chris Keschnat
2023-09-25 9:32 ` Bruno Barbier [this message]
2023-09-25 17:36 ` Chris Keschnat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=651153a4.7b0a0220.f4676.c846@mx.google.com \
--to=brubar.cs@gmail.com \
--cc=chris@catsu.it \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).