How To - Avoid Warning 505 Division by Zero in Watch Window

The Watch Window supports mathematical expressions (see such as (myArray / MyArrayPct). Sometimes, my denominator array contains a null value and, during my debug, I receive a Warning 505 division by zero. Divisor array at [91] is equal zero. The resulting array element is set to "-nan(ind).

Since functions (i.e. NZ()) are not supported in the watch window, I was wondering if anyone can offer a simple workaround so that zero can be returned rather than the warning.

If your denominator is zero, you can add small value to denominator


If your denominator is Null in the middle of array then you have error in code before that you should fix instead of inventing workarounds.


Hi expert,

This is my function :

function Ratio(H1,B1) { bon= (H1-B1)/B1 ; return bon ; } ;

where I’m write the next line



You can now use SafeDivide function AFL Function Reference - SAFEDIVIDE