Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If-Then-Else + Multiple var assignment 1

Status
Not open for further replies.

butkus

MIS
Sep 4, 2001
114
US
Using Crystal syntax, what can be used to force multiple variable assignments following a true condition within If-Then-Else control structure?

Example:
If (Shared StringVar) = (condition) then
Shared StringVar := (something)
Shared StringVar := (something) Else
IF (Shared StringVar) = (condition) then
Shared StringVar := (another something);
 
Shared StringVar var1;
Shared StringVar var2;
Shared StringVar var3;

If var3 = (condition1) then
(
var1 := (something1);
var2 := (something2);
)
Else If var3 = (condition2) then
var1 := (another something);
 
Thanks, I had no idea that the:
( ) could be used for multiple assignments.
I worked btw.

Do you, or anyone for that matter, know of a Crystal Syntax - syntax guide. Application and web site help are lacking at best.

Thnaks
 
I keep forgetting that syntax myself, so I put an example on my web site and refer to it when I need it. My FAQ on common formula examples in the General forum has a link to this and a few other examples. Not really a general syntax guide, though. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Some of it is trial and error. I use the () syntax especially when I nest If - else if - else situations.

I find that it gives:

1. Crystal a direction and a processing order.
which you might not realize is happening otherwise
in a complicated senario.
2. It helps you work out complicated logic in forming
the structure.

There is a similar () structure for for-next and while loops and also for select case structures.

I did find a bug when combining a select case structure with a multi statement If but through trial and error I eventually got it to work....I cannot say exactly what it was except that it had to do with a placement of a critcal ";" ...I'd have to do some digging to find it.

Also the "bug" may be fixed in 8.5 (I use 8.0)

Jim

As far as help with the structures go....the BEST RESOURCE IS RIGHT HERE!!!! (in my opinion)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top