Polarican0115
Technical User
CR2011
I created a Crosstab report By Specialty Dept that displays Sales, Gross Profit and Gross Profit % by Order Type (Stock Sales/Direct Sales).
The Problem I am encountering is when the Sum of Specialty Dept = $0.00 but the Gross Profit Margin has a value, the Margin % does not get calculated correctly
To get Sales, Margin and Percentage in the Crosstab, I created the following:
Sales (Suppress formula)
whileprintingrecords;
numbervar tot := currentfieldvalue;
false
Gross Profit $ (Suppress Formula)
whileprintingrecords;
numbervar coded := currentfieldvalue;
false
Gross Marg % (Display String formula)
whileprintingrecords;
numbervar tot;
numbervar coded;
if tot <> 0 then
totext(coded%tot,2)+"%" //2 for two decimals
else "0.00%"//Added this because if tot = 0 it will be suppressed
This is what displays on the Crosstab report:
[/URL]]
If I do the following, (Comment out the if tot <> 0) I get the Divide by zero message:
whileprintingrecords;
numbervar tot;
numbervar coded;
//if tot <> 0 then
totext(coded%tot,2)+"%" //2 for two decimals
//else "0.00%"
[/URL]]
Any help/suggestions would be greatly appreciated.
I created a Crosstab report By Specialty Dept that displays Sales, Gross Profit and Gross Profit % by Order Type (Stock Sales/Direct Sales).
The Problem I am encountering is when the Sum of Specialty Dept = $0.00 but the Gross Profit Margin has a value, the Margin % does not get calculated correctly
To get Sales, Margin and Percentage in the Crosstab, I created the following:
Sales (Suppress formula)
whileprintingrecords;
numbervar tot := currentfieldvalue;
false
Gross Profit $ (Suppress Formula)
whileprintingrecords;
numbervar coded := currentfieldvalue;
false
Gross Marg % (Display String formula)
whileprintingrecords;
numbervar tot;
numbervar coded;
if tot <> 0 then
totext(coded%tot,2)+"%" //2 for two decimals
else "0.00%"//Added this because if tot = 0 it will be suppressed
This is what displays on the Crosstab report:
If I do the following, (Comment out the if tot <> 0) I get the Divide by zero message:
whileprintingrecords;
numbervar tot;
numbervar coded;
//if tot <> 0 then
totext(coded%tot,2)+"%" //2 for two decimals
//else "0.00%"
Any help/suggestions would be greatly appreciated.