emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mario Frasca <mario@anche.no>
To: emacs-orgmode@gnu.org
Cc: Michael Brand <michael.ch.brand@gmail.com>
Subject: Re: empty/nil in table cells
Date: Fri, 10 Jul 2020 09:27:54 -0500	[thread overview]
Message-ID: <ca8c2b09-f656-fb92-edba-2774fc805bf7@anche.no> (raw)
In-Reply-To: <87a7084afo.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

On 09/07/2020 16:59, Nicolas Goaziou wrote:
>> and it simplifies a lot writing functions.
> How so?

thank you Michael, for answering Nicolas' question, in a different and 
much structured way than I did in my original message.

the formula you provided —I reduced it slightly, hard coding a constant— 
looks like this:

(if (> @# 4) (format "%.2f" (/ (apply '+ (subseq '(@I$2..@II$2) (- @# 1 
4) (- @# 1))) 4.0)) ""));N

my impression is this programs in the spreadsheet something that should 
be part of the org-table software.

if we let references leading outside the table return 'nil instead of 
raising an error, and represent 'nil by the empty string, then this is 
enough:

(when (> @# 4) (/ (+ @-3$2..$2) 4.0));L%0.2f

my suggestion is to associate 'nil with empty cells "both ways", in the 
sense that a formula returning 'nil causes an empty org-table cell (see 
above), and that the empty cell, through the L filter evaluates to nil 
and not to the empty string.  this for symmetry, and for uniformity with 
reference leading outside the table.

regards,

MF


[-- Attachment #2: Type: text/html, Size: 1711 bytes --]

      parent reply	other threads:[~2020-07-10 14:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 17:08 empty/nil in table cells Mario Frasca
2020-07-09 21:59 ` Nicolas Goaziou
2020-07-09 22:06   ` Mario Frasca
2020-07-10  7:15     ` Michael Brand
2020-07-10 10:11     ` Nicolas Goaziou
2020-07-10 14:27   ` Mario Frasca [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=ca8c2b09-f656-fb92-edba-2774fc805bf7@anche.no \
    --to=mario@anche.no \
    --cc=emacs-orgmode@gnu.org \
    --cc=michael.ch.brand@gmail.com \
    /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).