Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal Variable Problem

Posted on 2011-03-01
7
Medium Priority
?
342 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 2000 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
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 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