Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Variable scope and formatting Post Reply Post New Topic
Author Message
rvink
Groupie
Groupie
Avatar

Joined: 04 Feb 2008
Location: New Zealand
Online Status: Offline
Posts: 55
Quote rvink Replybullet Topic: Variable scope and formatting
     Posted: 20 Jun 2010 at 6:09pm
I'm doing a validation report. It has a formula which checks the field values and builds an error string that is printed for each record. In the same formula it would also be nice to highlight the invalid field by changing its background color. I could duplicate the error checking logic in the background color of each field but that is a maintenance nightmare.

Is there any way to change the format (eg background color) of a field using a regular formula? I see no way to reference properties of other fields with crystal.

Another approach: I tried to put the field validation in the background color formula, referencing a global variable, but it does not work. Do variables declared inside formatting formulas live in a different "space" from variables declared in other formulas?


IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 21 Jun 2010 at 3:09am
in formulas for coloring a field, the entire field will be the same color.  Formulas don't give you the option of changing a section of a string to a different color or font.
 
As for scoping of variables, global is available to the report in which it was declared.  I have had no issues with accessing a global variable in a formatting formula.
 
HTH
IP IP Logged
rvink
Groupie
Groupie
Avatar

Joined: 04 Feb 2008
Location: New Zealand
Online Status: Offline
Posts: 55
Quote rvink Replybullet Posted: 22 Jun 2010 at 3:53pm
Thanks, working now. I needed to add "WhilePrintingRecords" to both formulas to get them to work.
IP IP Logged
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