Link to home
Start Free TrialLog in
Avatar of Richard Cooper
Richard CooperFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Crystal Variable Problem

I have to update several shared variables based on the scrap code:

if {bsp_Quality.FaultCode}="99" then
    M99:= M99 + {bsp_Quality.Qty}; 
    TotalScrapM99:= TotalScrapM99 + {bsp_Quality.Qty};
    TotalMatScrap:={bsp_Quality.Shot}*{bsp_Quality.Qty};
else if {bsp_Quality.FaultCode}="M01" then ...

Open in new window


I get an error after this line M99:= M99 + {bsp_Quality.Qty};  stating the rest of the text is not part of the formula.
What am I missing?
ASKER CERTIFIED SOLUTION
Avatar of reb73
reb73
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richard Cooper

ASKER

I get the ) is missing and TotalScrapM99: is highlighted
Avatar of peter57r
The syntax for such code is a bit difficult.
Remove the ; on the line before the )

In your Else structure you need ...

else
(
firstline;
secondline;
thirdline
);
Avatar of Mike McCracken
Mike McCracken

What is the full code?

The variables don't appear to be declared.
All variables used in a formula must be declared in the formula.
Unlike some languages you must declare the variable in each formula not just in a formula at the start of the report.

mlmcc
The Variable TotalMatScrap was not declared correctly.
Since you had to change the declaration, why wasn't my comment selected as part of the answer.  The ( ) being required was part of the answer though not to the actual error.

mlmcc
mlmcc,

 There was a typo in the variable. It had been declared, I checked the code before I read your post. Even without the typo the error was the same no ( )

Sorry.