emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: Kristof Ralovich <kristof@ralovich.hu>
Cc: emacs-orgmode@gnu.org
Subject: Re: table formula, empty field, duration
Date: Sat, 05 Sep 2020 15:31:16 +0200	[thread overview]
Message-ID: <87tuwcic4b.fsf@gnu.org> (raw)
In-Reply-To: <5bce53e44fd04641e977a3ea52ed7d521670a678.camel@ralovich.hu> (Kristof Ralovich's message of "Thu, 06 Aug 2020 08:24:23 +0200")

Hi Kristof,

Kristof Ralovich <kristof@ralovich.hu> writes:

> it appears to me that the concept of "empty field" is not defined for
> time durations, or it is quite different to how it is defined for
> numbers (using org-mode 9.1.9).
>
> In the first table, the empty row @6 produces an empty field for the sum
> ($5, first formula), that vmean is able to "skip" (second formula) and
> gives the expected result 8.25 (=33/4).
>
> #+TBLNAME: works_with_numbers
> | h | start | end | h | sum |    h | h |
>
> |---+-------+-----+---+-----+------+---|
> |   |    08 |  18 |   |  10 |      |   |
> |   |    11 |  15 |   |   4 |      |   |
> |   |    09 |  20 |   |  11 |      |   |
> |   |    10 |  18 |   |   8 |      |   |
> |   |       |     |   |     |      |   |
> |---+-------+-----+---+-----+------+---|
> |   |       |     |   |  33 | 8.25 |   |
>
> #+TBLFM: $5=if(typeof($3-$2)==12, string(""), $3-$2);E::@>$5=vsum(@2..@-1);
> #+TBLFM: @>$6=vmean(@2$5..@-1$5);

Can you provide a more minimal example?

The following table works correctly here (maint and master):

| mean1 | mean2 |
|-------+-------|
| 08:00 | 08:00 |
| 09:00 | 09:00 |
| 00:00 |       |
|-------+-------|
| 05:40 | 08:30 |
#+TBLFM: @5$1=vmean(@2..@-1);U
#+TBLFM: @5$2=vmean(@2..@-1);U

So I suspect this is something wrong with your first formula:

> #+TBLFM: $5=if(typeof($3-$2)==12, string(""), $3-$2);E

Let me know if you manage to nail down something more precise.

Thanks,

-- 
 Bastien


      reply	other threads:[~2020-09-05 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06  6:24 table formula, empty field, duration Kristof Ralovich
2020-09-05 13:31 ` Bastien [this message]

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=87tuwcic4b.fsf@gnu.org \
    --to=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=kristof@ralovich.hu \
    /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).