June 28, 200520 yr 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
June 28, 200520 yr A null is smaller than 4, so if you want a different result when IsEmtpty (NUM), you do need to specify this explicitly.
June 28, 200520 yr 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")
June 28, 200520 yr 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
June 28, 200520 yr Author 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
June 28, 200520 yr 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"
June 28, 200520 yr 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" )
June 28, 200520 yr 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!)
Create an account or sign in to comment