Any advice on how to avoid division by zero with a select case statement?
Here is what I have:
whileprintingrecords;
If {sp_Classified_Position_Report;1.VALVAL_CMB_AMT}>0 then
SELECT {sp_Classified_Position_Report;1.ASSET_CLASS_MNEM}
Case "FIXED INC": {sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/Sum ({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{sp_Classified_Position_Report;1.ASSET_CLASS_MNEM})*100
Case "EQUITY": ({sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Case "CASH": ({sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Case "CURR EQUIV"{sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Case "REC/PAY"{sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Case "OTHER": ({sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Else 0;
I get the error message: "The remaining text does not appear to be part of the formula."
TIA
Here is what I have:
whileprintingrecords;
If {sp_Classified_Position_Report;1.VALVAL_CMB_AMT}>0 then
SELECT {sp_Classified_Position_Report;1.ASSET_CLASS_MNEM}
Case "FIXED INC": {sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/Sum ({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{sp_Classified_Position_Report;1.ASSET_CLASS_MNEM})*100
Case "EQUITY": ({sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Case "CASH": ({sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Case "CURR EQUIV"{sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Case "REC/PAY"{sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Case "OTHER": ({sp_Classified_Position_Report;1.VALVAL_CMB_AMT}/sum({sp_Classified_Position_Report;1.VALVAL_CMB_AMT},{@MySort})*100)
Else 0;
I get the error message: "The remaining text does not appear to be part of the formula."
TIA