emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Check on empty does not work
@ 2014-06-01  9:50 Cecil Westerhof
  2014-06-01 10:00 ` Cecil Westerhof
  0 siblings, 1 reply; 4+ messages in thread
From: Cecil Westerhof @ 2014-06-01  9:50 UTC (permalink / raw)
  To: emacs-orgmode

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

I am trying the following:
    #+TBLFM: @-I$4..@+I$4 = if("$3" == "nan", string(""), $3 - $2) ; %.1f
and:
    #+TBLFM: @-I$4..@+I$4 = if("$3" == "", string(""), $3 - $2) ; %.1f

But in both case the fourth field is filled when the third field is empty.
What am I doing wrong?

I am using version 8.2.1.

-- 
Cecil Westerhof

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

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

* Re: Check on empty does not work
  2014-06-01  9:50 Check on empty does not work Cecil Westerhof
@ 2014-06-01 10:00 ` Cecil Westerhof
  2014-06-01 10:58   ` Michael Brand
  0 siblings, 1 reply; 4+ messages in thread
From: Cecil Westerhof @ 2014-06-01 10:00 UTC (permalink / raw)
  To: emacs-orgmode

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

2014-06-01 11:50 GMT+02:00 Cecil Westerhof <cldwesterhof@gmail.com>:

> I am trying the following:
>     #+TBLFM: @-I$4..@+I$4 = if("$3" == "nan", string(""), $3 - $2) ; %.1f
> and:
>     #+TBLFM: @-I$4..@+I$4 = if("$3" == "", string(""), $3 - $2) ; %.1f
>
> But in both case the fourth field is filled when the third field is empty.
> What am I doing wrong?
>
> I am using version 8.2.1.
>

​The following does work:
    #+TBLFM: @-I$4..@+I$4 = if($3 - $2 == -$2, string(""), $3 - $2) ;

But is not what is described.

I removed
    %.1f
because that displays an empty string as 0.0.

Is it possible to use %.1f without making an empty field displayed as 0.0?

-- 
Cecil Westerhof

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

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

* Re: Check on empty does not work
  2014-06-01 10:00 ` Cecil Westerhof
@ 2014-06-01 10:58   ` Michael Brand
  2014-06-01 11:31     ` Cecil Westerhof
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Brand @ 2014-06-01 10:58 UTC (permalink / raw)
  To: Cecil Westerhof; +Cc: Org Mode

Hi Cecil

On Sun, Jun 1, 2014 at 12:00 PM, Cecil Westerhof <cldwesterhof@gmail.com> wrote:
> 2014-06-01 11:50 GMT+02:00 Cecil Westerhof <cldwesterhof@gmail.com>:
>> I am trying the following:
>>     #+TBLFM: @-I$4..@+I$4 = if("$3" == "nan", string(""), $3 - $2) ; %.1f
>> and:
>>     #+TBLFM: @-I$4..@+I$4 = if("$3" == "", string(""), $3 - $2) ; %.1f
>>
>> But in both case the fourth field is filled when the third field is empty.
>> What am I doing wrong?
>>
>> I am using version 8.2.1.
>
> The following does work:
>     #+TBLFM: @-I$4..@+I$4 = if($3 - $2 == -$2, string(""), $3 - $2) ;
>
> But is not what is described.
>
> I removed
>     %.1f
> because that displays an empty string as 0.0.
>
> Is it possible to use %.1f without making an empty field displayed as 0.0?

I suggest that I will improve the TBLFM example about "nan" in the
manual like this:

    `if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1'
         Sum of the first two columns.  When at least one of the input
         fields is empty the Org table result field is set to empty.  `E'
         is required to leave empty fields without conversion to 0.  `f-1'
         is an optional Calc format string similar to `%.1f' but leaves
         empty results empty.

Would this have answered all your questions?

Michael

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

* Re: Check on empty does not work
  2014-06-01 10:58   ` Michael Brand
@ 2014-06-01 11:31     ` Cecil Westerhof
  0 siblings, 0 replies; 4+ messages in thread
From: Cecil Westerhof @ 2014-06-01 11:31 UTC (permalink / raw)
  To: emacs-orgmode

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

2014-06-01 12:58 GMT+02:00 Michael Brand <michael.ch.brand@gmail.com>:

> On Sun, Jun 1, 2014 at 12:00 PM, Cecil Westerhof <cldwesterhof@gmail.com>
> wrote:
> > 2014-06-01 11:50 GMT+02:00 Cecil Westerhof <cldwesterhof@gmail.com>:
> >> I am trying the following:
> >>     #+TBLFM: @-I$4..@+I$4 = if("$3" == "nan", string(""), $3 - $2) ;
> %.1f
> >> and:
> >>     #+TBLFM: @-I$4..@+I$4 = if("$3" == "", string(""), $3 - $2) ; %.1f
> >>
> >> But in both case the fourth field is filled when the third field is
> empty.
> >> What am I doing wrong?
> >>
> >> I am using version 8.2.1.
> >
> > The following does work:
> >     #+TBLFM: @-I$4..@+I$4 = if($3 - $2 == -$2, string(""), $3 - $2) ;
> >
> > But is not what is described.
> >
> > I removed
> >     %.1f
> > because that displays an empty string as 0.0.
> >
> > Is it possible to use %.1f without making an empty field displayed as
> 0.0?
>
> I suggest that I will improve the TBLFM example about "nan" in the
> manual like this:
>
>     `if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1'
>          Sum of the first two columns.  When at least one of the input
>          fields is empty the Org table result field is set to empty.  `E'
>          is required to leave empty fields without conversion to 0.  `f-1'
>          is an optional Calc format string similar to `%.1f' but leaves
>          empty results empty.
>
> Would this have answered all your questions?
>

​That does what I want. Thanks.

-- 
Cecil Westerhof

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

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

end of thread, other threads:[~2014-06-01 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-01  9:50 Check on empty does not work Cecil Westerhof
2014-06-01 10:00 ` Cecil Westerhof
2014-06-01 10:58   ` Michael Brand
2014-06-01 11:31     ` Cecil Westerhof

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