# Numeric field characteristics

This topic is 6987 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

Hi,

I have a calculation that is looking at a numeric field (NUM):

if(NUM <4; "ok"; "not ok")

(The calculation is actually more involved, but this is the part causing problems...I've simplified the results - "ok" and "not ok" - just for ease of explanation here.)

The problem I'm seeing is that if NUM is left blank, the calculation evaluates it as zero, thus causing the result to be "ok", when I need the result to be "ok" only if NUM contains 1, 2, or 3.

I would imagine that the simplest way to resolve the issue is to put an additional "if NUM is blank then" condtion into the calculation, but for a variety of reasons I would like to avoid this. Does anyone know of another solution?

Many thanks, and apologies if this is a ridiculously simple question!

julia

##### Share on other sites

Try,

Case(NUM =""; ""; NUM<4; "ok"; "not ok")

HTH

Lee

##### Share on other sites

A null is smaller than 4, so if you want a different result when IsEmtpty (NUM), you do need to specify this explicitly.

##### Share on other sites

Ciao,

try this calculation:

If(Num * Num / Num <4; "ok"; "not ok")

(if you write some space inside Num, the result will be "not ok". The result will be "" if NUM is left blank, but you setted the CalcField to "not evaluate if all referenced fields are empty")

##### Share on other sites

Hi raybaudi,

I guess it is a matter of what julia wants to be the answer for 0.

0 produces Ok in the other two calculations and Not Okay in yours.

Lee

##### Share on other sites

Thanks all for the suggestions - I appreciate it. I tinkered with a few things, and think that a Case() scenario is probably the best bet for this purpose. I forgot to mention that the NUM field is validated upon data entry with a range that doesn't include zero.

I think I'm all set. Thanks again! Much appreciated.

julia

##### Share on other sites

Hi Lee Smith,

she said:

when I need the result to be "ok" only if NUM contains 1, 2, or 3.

so I assumed that for 0 she needs "not ok"

##### Share on other sites

I need the result to be "ok" only if NUM contains 1, 2, or 3

I missed that part. Then perhaps the best way would be to say exactly that:

Case ( Position ( "x1x2x3x" ; "x" & NUM & "x" ; 1 ; 1 ) ; "OK" ; "NOT OK" )

##### Share on other sites

Hi comment

your solution is very good !

She also said:

I would imagine that the simplest way to resolve the issue is to put an additional "if NUM is blank then" condtion into the calculation, but for a variety of reasons I would like to avoid this.

So I tried to not use a case function , as it's the same of a multi-if function.

(BTW my calc is good also for decimals!)

##### Share on other sites

This topic is 6987 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account