Solved

Crystal Variable Problem

Posted on 2011-03-01
7
341 Views
Last Modified: 2012-08-14
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?
0
Comment
Question by:RickCooper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 25

Accepted Solution

by:
reb73 earned 500 total points
ID: 35007959
If I'm not mistaken a multi-statement block has to be enclosed within brackets ()

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 ...
0
 
LVL 1

Author Comment

by:RickCooper
ID: 35008001
I get the ) is missing and TotalScrapM99: is highlighted
0
 
LVL 77

Expert Comment

by:peter57r
ID: 35008090
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
);
0
Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

 
LVL 101

Expert Comment

by:mlmcc
ID: 35008148
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
0
 
LVL 1

Author Closing Comment

by:RickCooper
ID: 35008460
The Variable TotalMatScrap was not declared correctly.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 35009511
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
0
 
LVL 1

Author Comment

by:RickCooper
ID: 35010185
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.

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question