yeddaborg Posted June 28, 2005 Posted June 28, 2005 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
Lee Smith Posted June 28, 2005 Posted June 28, 2005 Try, Case(NUM =""; ""; NUM<4; "ok"; "not ok") HTH Lee
comment Posted June 28, 2005 Posted June 28, 2005 A null is smaller than 4, so if you want a different result when IsEmtpty (NUM), you do need to specify this explicitly.
Raybaudi Posted June 28, 2005 Posted June 28, 2005 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")
Lee Smith Posted June 28, 2005 Posted June 28, 2005 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
yeddaborg Posted June 28, 2005 Author Posted June 28, 2005 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
Raybaudi Posted June 28, 2005 Posted June 28, 2005 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"
comment Posted June 28, 2005 Posted June 28, 2005 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" )
Raybaudi Posted June 28, 2005 Posted June 28, 2005 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!)
Recommended Posts
This topic is 7156 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now