First time trying to program with Crystal Reports. I am trying to write a simple enough one. There are different fields grouped together, and I am planning to run the formula on each group. In the below image is an example of a group.
The highlighted 20.00
in the upper right corner of the image is the shipctns
. My formula is
Local NumberVar RTotal := 0;
Local NumberVar diff := 0;
While RTotal < {@shipctns} DO
(
If ({@pickctns} < {@shipctns}) AND (RTotal + {@pickctns} < {@shipctns}) THEN
"Pick";
RTotal := RTotal + {@pickctns};
Else If {@pickctns} < {@shipctns} THEN
"Pick " & ({@shipctns} - RTotal);
Else
"Don't Pick"
);
The formula is still a work in progress. It's just to go through the Pick Ctns
in each group, and say to pick this amount to make up the shipctns
amount. Only select part of the last Pick Ctns
if it is too large and then stop.
My problem is that I can't really test out the formula because I am getting an error on the Else If
saying "The ) is Missing". I don't really know Crystal Reports so what am I doing wrong here?
You need to surround multiple statements within a
then
orelse
block with parentheses.From the Crystal Reports documentation:
Your formula should look like this