Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Doing more than one thing in a conditional Post Reply Post New Topic
Author Message
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Topic: Doing more than one thing in a conditional
    Posted: 11 Apr 2007 at 1:46am
Hi,
 
I am trying to set the Background colour of a field to white & at the same time set a global flag to indicate to the fields formula that the field is white.
 
However the code throws an error when adding an extra line. I can't terminate the expressions in the block which is why I'm getting the error. On one hand it won't allow me to terminate; on the other I need to seperate these expressions;by a terminator.
 
How can this be done? Below is a snippet:
 
 
global BooleanVar IsWhite;
 
if true then
    color(255,255,255)  //white
    IsWhite := true
 
else
   color(0,0,0)
   IsWhite := false
 
 
Thanks very much for any ideas. Crystal is so different to other languages, its crazy!Dead
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 11 Apr 2007 at 3:25pm

I don't think you can do it this way, but you could create a formula that would evaluate the condition for IsWhite.  This formula would then be available to other formulas AND to the formula for setting the background color.  Your IsWhite formula would contain JUST the condition to be evaluated - no If...Then...Else.  "If <condition> then true else false" is redundant because <condition> itself evaluates to true or false.  So, the formula would look something like this:

(this = that) and (a != b)
 
Your background formula then would look like this:

if {@IsWhite) then color(255,255,255) else color(0,0,0)

 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.000 seconds.