emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: Re: problem with empty column
Date: Fri, 05 Jan 2018 13:44:52 +0100	[thread overview]
Message-ID: <87lghcwk3f.fsf@mat.ucm.es> (raw)
In-Reply-To: 87zi5sk5ru.fsf@gmail.com

>>> "Eric" == Eric S Fraga <esflists@gmail.com> writes: 
 
    > On Friday,  5 Jan 2018 at 09:28, Uwe Brauer wrote: [...] 
 
    >> The last row behaves strangely the cell in the second 
    >> column is *not* empty but the cell in the third one is, 
    >> nevertheless the cell in the last column contains the 
    >> string nan, which I don't understand. 
 
    > But the second column is *not* empty; maybe you meant 3rd 
    > column? 

What I meant is this.

Take the following simple table

| Name   | E1 | E2 | E3 | E4 | Res | 
|--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 | 
|| Entry2 | 10 | 20 | 30 | 40 |     | #+TBLFM: $6=($2+$3+$4+$5)/10 

 C-u C-u C-c C-c
 leads to 

| Name   | E1 | E2 | E3 | E4 | Res | 
|--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 | 
|13 | Entry2 | 10 | 20 | 30 | 40 |  10 | #+TBLFM: 
|$6=($2+$3+$4+$5)/10 

Now for any new entry I want to have in the 6th column NP if the 
entry in the second column (not the whole column) is empty.

| Name   | E1 | E2 | E3 | E4 | Res | 
|--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 | 
|13 | Entry2 | 10 | 20 | 30 | 40 |  10 | Entry3 |    |    |    | 
||     | 

Should lead to
| Name   | E1 | E2 | E3 | E4 | Res | 
|--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 | 
|13 | Entry2 | 10 | 20 | 30 | 40 |  10 | Entry3 |    |    |    | 
||  NP | 


How can I achieve that?

The following works well

| Name   | E1 | E2 | E3 | E4 | Res | 
|--------+----+----+----+----+-----| Entry1 |    |    |    |    | 
|NP  | Entry2 | 10 | 20 | 30 | 40 | 10  | #+TBLFM: $6=if("$2" == 
|"nan" , string("NP"),($2+$3+$4+$5)/10);E 

although the second column is *not* empty, but it is empty for 
Entry 1. 

But fails if there is a row like this

 
| Name   | E1 | E2 | E3 | E4 | Res | 
|--------+----+----+----+----+-----| Entry1 |    |    |    |    | 
|NP | Entry2 | 10 | 20 | 30 | 40 |  10 | Entry3 | 10 |    | 20 | 
|30 | nan | #+TBLFM: $6=if("$2" == "nan" , 
|string("NP"),($2+$3+$4+$5)/10);E 

Uwe 

  reply	other threads:[~2018-01-05 12:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-05  8:28 problem with empty column Uwe Brauer
2018-01-05  9:25 ` Loris Bennett
2018-01-05  9:35 ` Eric S Fraga
2018-01-05 12:44   ` Uwe Brauer [this message]
2018-01-05 13:55     ` Michael Brand
2018-01-06  8:43       ` Uwe Brauer
2018-01-05 14:46     ` Eric S Fraga
2018-01-06  8:37       ` Uwe Brauer
2018-01-06 11:23         ` Eric S Fraga

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=87lghcwk3f.fsf@mat.ucm.es \
    --to=oub@mat.ucm.es \
    --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).