Skip to Content
1
Former Member
Mar 23, 2009 at 10:14 PM

Division by 0 problem

23 Views

Hi experts.

I am trying to do a calculation of a margin in a financial report, but I cant get the formula to work.

I am very new to crystal so it is probably something very simple.

My 'Margin' formula is as follows:-

-


WhilePrintingRecords;

Global NumberVar Array Hld;

{@GPDisp1} / Hld[1];

-


(I created a Hld array to hold 14 columns worth of data)

I have displayed the Hld[1] field separately and it shows a value of 23.7 as I expect.

//Hld[1];

I have also displayed the running total of @GPDisp1 and it show the value of 27.8 also as I expect.

//{@GPDisp1};

I tried setting another variable to the calculation and then displaying that but get the same division by 0 error.

//local numbervar Margin := ({@GPDisp1} / Hld[1]);

//Margin;

Any other suggestions much appreciated.

Thanks

Denise