Ask a questionAsk a question
 

Questiondivide by zero error

  • Friday, November 06, 2009 2:40 PMdvandeus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    IIF ({command.P_SALES_AMT}<>0

    and ({command.SALES_AMT}-{command.P_SALES_AMT})<>0,

    {command.SALES_AMT}-{command.P_SALES_AMT}  , 989)

     

    The above formula for the third column results in the following:

    Sales Amt      Sales Amt (P)               Formula

    42,462.36      158,347.85                  -115,885.49

      7,674.51          7,066.93                           607.58

             0.00          1,663.89                       -1,663.89

             0.00          1,233.78                       -1,233.78

    23,777.84        14,128.84                        9,649.00

          159.84                0.00                           989.00

     

    IIF ({command.P_SALES_AMT}<>0

    and ({command.SALES_AMT}-{command.P_SALES_AMT})<>0,

    {command.SALES_AMT}-{command.P_SALES_AMT}/{command.P_SALES_AMT}  , 989)

     

    When I add the division, I get a “divide by zero” error. The last line of data should have still been set to 989. Why didn’t it?