Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help to show discrepancy between fields Post Reply Post New Topic
Page  of 2 Next >>
Author Message
Callie57
Newbie
Newbie
Avatar

Joined: 02 Jul 2012
Location: United Kingdom
Online Status: Offline
Posts: 13
Quote Callie57 Replybullet Topic: Help to show discrepancy between fields
     Posted: 02 Jul 2012 at 10:12pm
I hope someone can help with this problem. I am trying to highlight anomalies between fields in a crystal report. I have one field which comes from a table of  data and indicates from that if there was a rescue carried out (yes or no) and 2 other fields which show the number of rescues either by one means or another (Field is a number). I want to highlight the rescue field when it is 'no' but there is a number in either of the other two fields. I hope I have made this clear and any help appreciated. Thanks
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 03 Jul 2012 at 3:46am
Right-click on the yes/no field and select Format....  Go to the Border tab.  Turn on the Background color and click on the formula button to the right of the color drop-down list.  Using your field names, use a formula that is similar to this:
 
If IsNull({table.Value1}) and IsNull({table.Value2}) then crNoColor
else if not IsNull({table.Value1}) and {table.Value1} > 0 then crYellow
else if not IsNull({table.Value2}) and {table.Value2} > 0 then crYellow
else crNoColor
 
-Dell
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Jul 2012 at 3:46am
use a conditional background color formula on the field you want to draw attention to
if you have Nulls in the data set make sure to flip the option in the formual editor to use defualt values for nulls, otherwise it won't highlight if any of the 3 fields are null
 
if table.rescue='No' and (table.means1>0 or table.means2>0) then crRed else crnocolor
 
Edited: Sorry Hilfy, didn't mean tyo double answer...was typing when you posted.


Edited by DBlank - 03 Jul 2012 at 3:47am
IP IP Logged
Callie57
Newbie
Newbie
Avatar

Joined: 02 Jul 2012
Location: United Kingdom
Online Status: Offline
Posts: 13
Quote Callie57 Replybullet Posted: 03 Jul 2012 at 4:11am
Thanks for the quick reply - I have tried that and between the two answers it works!! CheersThumbs%20Up
IP IP Logged
Callie57
Newbie
Newbie
Avatar

Joined: 02 Jul 2012
Location: United Kingdom
Online Status: Offline
Posts: 13
Quote Callie57 Replybullet Posted: 03 Jul 2012 at 4:42am
oops - spoke too soon - It is only highlighting the 'no's' where there is a figure in 'means 1 ' If  Means 2 has a 1 or a 2 in it it is staying 'no colour' Any ideas? Cheers Confused
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 03 Jul 2012 at 6:07am

Please post your exact formula so we can see what's going on.  Thanks!

 
-Dell
IP IP Logged
Callie57
Newbie
Newbie
Avatar

Joined: 02 Jul 2012
Location: United Kingdom
Online Status: Offline
Posts: 13
Quote Callie57 Replybullet Posted: 03 Jul 2012 at 8:52pm
if {IRS_VICTIMS.WASRESCUED} ='No'
and ({INCIDENT_FIRES.RESCUES_FS}>0 or {INCIDENT_FIRES.RESCUES_NOT_FS}>0) then crRed else crNoColor
 
It is highlighting the 'No' if there is a figure in RESCUES_FS but not if it is in  RESCUES_NOT_FS as you can see from the extract below. The fifth entry should be highlighted.
Any help appreciated Thanks
Cas RES FS RES Non FS Victim Was Rescued?
2 1 yes yes
2 1 yes no
2 1 yes no
2 1 yes no
3 1 yes no
3 1 yes yes
3   1 yes yes
 
IP IP Logged
Callie57
Newbie
Newbie
Avatar

Joined: 02 Jul 2012
Location: United Kingdom
Online Status: Offline
Posts: 13
Quote Callie57 Replybullet Posted: 03 Jul 2012 at 8:58pm
ah - it didnt copy the format - row 2,3,and 4 had the 'No' highlighted but the 5th wasnt!!Sorry not a good copy the heading align left and the figures right!!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Jul 2012 at 2:23am
Did you flip the option in the formula editor on how to handle nulls?
It needs to be set to use default values for nulls.
IP IP Logged
Callie57
Newbie
Newbie
Avatar

Joined: 02 Jul 2012
Location: United Kingdom
Online Status: Offline
Posts: 13
Quote Callie57 Replybullet Posted: 04 Jul 2012 at 2:34am
eh - sorry - being thick here -how do you do that? I'm used to fairly basic crystal reports - sorry!!
IP IP Logged
Page  of 2 Next >>
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