emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Calc/TBLFM: how to conditionally insert hours:minutes?
@ 2023-09-23 19:38 Chris Keschnat
  2023-09-25  9:32 ` Bruno Barbier
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Keschnat @ 2023-09-23 19:38 UTC (permalink / raw)
  To: emacs-orgmode


Hi,
I am trying to understand how to set hours:minutes values in tables conditionally.

Just setting hours directly works:

| 40:03:00 |
| 40:03:00 |
| 40:03:00 |
#+TBLFM: $1=40:03;T

But when doing that conditionally (first row different from the others),
I do not understand the behavior:

This seemed to work:

| 19:55:00 |
| 40:03:00 |
| 40:03:00 |
#+TBLFM: $1=if(@# <= 1, 19:55, 40:03);T

But after adjusting the minutes, this happens:

| 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?

PS: I have found that the same happens when I add parentheses:

| 40:03:00 |
| 40:03:00 |
| 40:03:00 |
#+TBLFM: $1=(40:03);T

| 00:00:40 |
| 00:00:40 |
| 00:00:40 |
#+TBLFM: $1=(40:01);T

PPS: I came across this when trying to understand the formulas here
https://github.com/clange/org-mode

Thanks
Chris


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

end of thread, other threads:[~2023-09-25 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-23 19:38 Calc/TBLFM: how to conditionally insert hours:minutes? Chris Keschnat
2023-09-25  9:32 ` Bruno Barbier
2023-09-25 17:36   ` Chris Keschnat

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