Expand my Community achievements bar.

Arithmetic over/underflow

Avatar

Level 1

On a form used in our hospitals for pre-admitting patients I'm trying to calculate BMI from height and weight.  I've put the formula in the script editor and it correctly calculates BMI, but when the form is first opened the following error message appears:

Script failed (language is formcalc; context is xfa[0].form[0].F[0].#subform[1].BMI[0]) script=(Weight*703)/Height*Height)

Error: arithmetic over/underflow.

I suspect this is because the denominator (Height*Height) is zero before a value has been entered into Height.  Is this correct, and regardless whether it is or not, how can I avoid this error message?  The users are nurses and they tend to unwind when they encounter technical error messages.

1 Reply

Avatar

Level 1

Found the answer myself.  It was a problem with a zero denominator.  By using an if/then/endif you can control when it's trying to run the calculation.

The original formula was (weight*703)/(height*height).

The solution was:

if(height>0)then(weight*703)*(height*height)endif

That prevents it from trying to run the calculation before a value has been entered in 'height'.