Tuesday, September 11, 2018

Rectify Error "Divisor is Equal to Zero" on Formula.

Creating an Item search using division formula where the denominator may have a zero value generates error "divisor is equal to zero" like the Formula (percent) below:

({price}-{averagecost})/{price}

The cause is attributed when trying to create a formula that returns zero value on results. To resolve, insert the SQL "NULLIF" on the denominator for zero denominator results to convert said value to "null" instead of "0", where the mathematical operation fails.

The formula must be set as:

({price}-{averagecost})/NULLIF({price},0)

 

 

No comments:

Post a Comment