Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Conditional background color Post Reply Post New Topic
Author Message
mcmaxx2
Newbie
Newbie


Joined: 10 Jan 2011
Location: Netherlands
Online Status: Offline
Posts: 2
Quote mcmaxx2 Replybullet Topic: Conditional background color
    Posted: 10 Jan 2011 at 10:32pm
Hello,

I would like to give a certain field a red background color when it's empty in CR-XI. But I can't get it right. I tried the following:

In the format editor on the Border tab I click on the formula icon of the background-part. And I use the formula:

if isnull then CRRED else CRNOCOLOR 

but I got a message about not enough arguments being given to the function. So I tried:

if isnull({vw_Asset.T0_Field1}) then CRRED else CRNOCOLOR
Where {vw_Asset.T0_Field1} is the field I'm trying to fill.

The function is accepted but nothing happens to the empty fields. I am beginning to wonder if the fields are really empty, but I don't know how to check this. Also It could be I am using the wrong part to fill the background, and I should be using the highlighting expert. Can anyone help me with this issue?
Thanks a lot in advance.
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 11 Jan 2011 at 1:25am
try to use 'Highlighting Expert'.
by:
- right click the field
- choose 'Highlighting Expert'
- click 'New'
- select the field you want to check in 'Value of'
  (in this case 'vw_Asset.T0_Field1').

and you can continue as you want for the rest information by changing the font / background / border.

you can also use a variable to check.


hope it help.

Emir W
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Jan 2011 at 4:25am
If Emir's suggestion does not work for you ... likely the value is NULL and that is why your formula is not working. There is technically nothing there to change the background color of .
Likely you are trying to highlight missing data int he report. If you do not want tio change the way your report handles NULLS
You can do this via a formula field and formatting
Create a formula field to convert your NULLS to one space or any text you want (like 'Missing'). You will also have to convert the T0_Field1 to text if is not.
 
if isnull({vw_Asset.T0_Field1}) then " " else {vw_Asset.T0_Field1}
 
then apply your red condtion to this formula field
if isnull({vw_Asset.T0_Field1}) then CRRED else CRNOCOLOR



Edited by DBlank - 11 Jan 2011 at 4:26am
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 11 Jan 2011 at 6:24pm
agree with DBlank suggestion.

by converting the Null value to one space (" ") or other value, it will be more easy to identify and check.


hope it help.

Emir W
IP IP Logged
mcmaxx2
Newbie
Newbie


Joined: 10 Jan 2011
Location: Netherlands
Online Status: Offline
Posts: 2
Quote mcmaxx2 Replybullet Posted: 16 Jan 2011 at 11:50pm
Hello Emir_W and DBlank,

I really think DBlank was right. Because that was the only way I got it to work. I will ask our supplier what kind field this is. Because I was trying to avoid creating so many formula fields. (I had to create 21 now)
But thanks a lot for the help, I am a happy user. Smile

IP IP Logged
Deverdits
Newbie
Newbie


Joined: 28 Feb 2011
Online Status: Offline
Posts: 7
Quote Deverdits Replybullet Posted: 28 Feb 2011 at 6:10am
Thank you all, this was driving me absolutely nuts.  Some of the things in Crystal make absolutely no sense, like this.  If there is no value, there still should be a background color possible.
 
Thanks again.
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.031 seconds.