Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

zero divide error in my query

Former Member
0 Likes
738

Hi Gurus

I keep getting a 0 divide error in my query, I think it's because some of the invoices have updated for 0.00 dollars, then we've fixed them and released them to accounting but you know these crap structures, they retain each document history, so have kept the 0.00 values.

THis is my calculation, can you see anything obviously wrong with it puleeeese.

CONT_MARG / (MAT_PRC-FRGT_PROV+ DISC_SURC+FREIGHT ) *100

thank u in advanced

Piroz

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
700

if not MAT_PRC-FRGT_PROV < 0 and

not DISC_SURC-FREIGHT < 0.

formula...

endif.

3 REPLIES 3
Read only

Former Member
0 Likes
701

if not MAT_PRC-FRGT_PROV < 0 and

not DISC_SURC-FREIGHT < 0.

formula...

endif.

Read only

Former Member
0 Likes
700

Hi,

Maybe one of them has value -1 oter 1 and than you get 0. Just debug it. Or log the cases when this expression below is equal to 0.

MAT_PRC-FRGT_PROV+ DISC_SURC+FREIGHT

/wg

Read only

0 Likes
700

Hi,

I would suggest to calculate the denominator first.

A = (MAT_PRC-FRGT_PROV+ DISC_SURC+FREIGHT ) * 100

If A > 0 then perform the other calculation of dividing the value by A.

This should solve problem.

Regards,

Shahu