Solved

Crystal Variable Problem

Posted on 2011-03-01
7
338 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
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 100

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 100

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal Report Error 14 84
Insert timestamp data field of max summary 8 41
Crystal Reports--specifying a specific detail row to select 2 53
Crystal image Object type? 7 33
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

808 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