Expand my Community achievements bar.

SOLVED

Error in formula

Avatar

Level 1

I am just learning this product.  I created a formula.  I get a error as I am fill out the form.   The error is below

Script Failed (language is formcalc; context is xfa[0].form1[0].#subform[0].Productivity[0]}

script=(hours)/(Volume)

error: arithmetic over/unerflow.

I have 2 fields one names hours and one named volume.  The formula is suppose to do the divison.  the formula works but when i enter a number in volume i get this error.  It will allow me to proceed and enter a number in hours and will do the divison and place the answer in the correct place.  If I put hours in before volume i done get the error. 

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

What is happening is that the calculate event fires when either (or any) of the dependent objects changes. So when the user inputs the volume, the productivity calculate event fires, but is dividing by zero (as there is no value in the hours field).

A simple if statement looks for null values in both fields first and if either are null then it does not do the calculation.

if (Volume == null or Hours == null) then

     $ = null

else

     $ = (Volume / Hours)

endif

Good luck,

Niall    

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

What is happening is that the calculate event fires when either (or any) of the dependent objects changes. So when the user inputs the volume, the productivity calculate event fires, but is dividing by zero (as there is no value in the hours field).

A simple if statement looks for null values in both fields first and if either are null then it does not do the calculation.

if (Volume == null or Hours == null) then

     $ = null

else

     $ = (Volume / Hours)

endif

Good luck,

Niall