Question

I am writing a simple formula in crystal reports. What I am trying to do is to calculate a total based on some conditions, store the result in a shared numberVar, then return the result. However, I get an error right after my else

WhilePrintingRecords;
EvaluateAfter({@Share_Hundred_Percent});
EvaluateAfter({@Less_Commission});
EvaluateAfter({@Payment_NICL});
EvaluateAfter({@Payment_PRCL});

Shared numberVar sumNetPayable;
numberVar result;

if({Command.GENCLIENTCODE}=990) then
    result:= {@Share_Hundred_Percent} - {@Less_Commission} + {@Payment_PRCL};
else
    result:= {@Share_Hundred_Percent} - {@Less_Commission};

sumNetPayable := sumNetPayable + result;

result

The remaining text does not appear to be part of the formula

Was it helpful?

Solution

Try this. Remove semicolon for Then in If

WhilePrintingRecords;
EvaluateAfter({@Share_Hundred_Percent});
EvaluateAfter({@Less_Commission});
EvaluateAfter({@Payment_NICL});
EvaluateAfter({@Payment_PRCL});

Shared numberVar sumNetPayable;
numberVar result;

if({Command.GENCLIENTCODE}=990) then
    result:= {@Share_Hundred_Percent} - {@Less_Commission} + {@Payment_PRCL}
else
    result:= {@Share_Hundred_Percent} - {@Less_Commission};

sumNetPayable := sumNetPayable + result;

result
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top