Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Conditional formatting for font color Post Reply Post New Topic
Author Message
petronas
Newbie
Newbie


Joined: 10 Nov 2008
Online Status: Offline
Posts: 6
Quote petronas Replybullet Topic: Conditional formatting for font color
     Posted: 27 May 2009 at 8:36pm
Hi All,

I have field "Type" which has values viz Process, Communication, Info, Total Errors, Total Successes.
I am trying to have different font color based on the value. The formula I use is:

if {command.type}="Process" then crnavy
else if {command.type}="Communication" then crnavy
else if {command.type} ="Info" then crnavy
else if {command.type}="Total Errors" then crteal
else if {command.type}="Total Successes" then crteal

It is just taking in the teal color for all. I do nitknow how should I go about it.

Thanks for your help,
Petronas
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 28 May 2009 at 7:03am
well it looks correct...so what I would do is create a formula like:
if {command.type}="Process" then "Process"
else if {command.type}="Communication" then "Communication"
else if {command.type} ="Info" then "Info"
else if {command.type}="Total Errors" then "Total Errors"
else if {command.type}="Total Successes" then "Total Successes"
 
and place it in the same section as the color changing, I would also drop in {command.type}, and then I would compare values.  Sometimes, it is not the code, but the data that messes you up, or you might find why it keeps going to crTeal.
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 May 2009 at 8:58am
I agree with lockwelle's approach. A couple of things to try to tweak your formula if it is not working:
trim({command.type}) or you could try an instr >0 instead of an =...
 
if instr({command.type},"Process")>0 then crnavy
else if instr({command.type},"Communication")>0 then crnavy
else if instr({command.type},"Info")>0 then crnavy else...
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