Help: Divide by Zero Errors

Avatar

Avatar
Level 2
_Harry_Kontos_
Level 2

Likes

0 likes

Total Posts

20 posts

Correct reply

0 solutions
View profile

Avatar
Level 2
_Harry_Kontos_
Level 2

Likes

0 likes

Total Posts

20 posts

Correct reply

0 solutions
View profile
_Harry_Kontos_
Level 2

06-11-2005

Hi, can someone please advise me on how to avoid script failure alerts (like the one below), which are generated because certain calculations are being performed before any positive value has yet been set in a numeric field?



Here is an example of the calculation:



--- form1.SF_CalculationTable.acview[0]::calculate - (FormCalc, client) --



(ac[0] / tr[0]) * 100



Error example:



Script failed (language is formcalc; context is

xfa[0].form[0].form1[0].SF_CalculationTable[0].acview[0])

script=(ac[0] / tr[0]) * 100

Error: arithmetic over/underflow.



update: it appears these erros are "divide by zero" errors.

So my questions are,

(1) would I put any javascript (to override the zeros) on the "validate" event or the "calculate" event, and on which of the three fields in question, acview[0] (the result), tr[0] (the denominator) or ac[0] (the numerator). and...



(2) What might that javascript look like?



--

Harry

Replies

Avatar

Avatar
Validate 1
Level 1
beardjeff
Level 1

Likes

0 likes

Total Posts

9 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
beardjeff
Level 1

Likes

0 likes

Total Posts

9 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
beardjeff
Level 1

15-07-2010

Your error message indicates your script is being executed as FormCalc, not JavaScript.

If you're using FormCalc try using an If statment to test for zero/null.

if (tr>0) then (ac/tr)*100 endif