Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Condtional Formating for data not filled in color coded for resp party

Status
Not open for further replies.

mhansler

Technical User
Feb 19, 2001
24
US
Hello, I'm testing a field for null values and then color coding the background based on who the record belongs to. I can not get it to work. If I change the default color to black (meaning it will change the records that have data to be completely black) as opposed to white, it works. So the syntax is correct. I'm confused as to what I'm doing wrong. Can someone help? I am using CR 9.0 Developer and it's a string field. Thank you.

if {@Silo} = "Services" and isnull({HPD_HELPDESK.ROOT_CAUSE}) then
rgb(153,204,204) else
if {@Silo} = "Infrastructure" and isnull({HPD_HELPDESK.ROOT_CAUSE}) then
rgb(204,204,153) else
if {@Silo} = "Information Assurance" and isnull({HPD_HELPDESK.ROOT_CAUSE}) then
rgb(153,255,255) else
if {@Silo} = "Win2K" and isnull({HPD_HELPDESK.ROOT_CAUSE}) then
rgb(255,255,204) else
if {@Silo} = "Messaging" and isnull({HPD_HELPDESK.ROOT_CAUSE}) then
rgb(255,204,204) else
if {@Silo} = "EMS" and isnull({HPD_HELPDESK.ROOT_CAUSE}) then
rgb(102,102,102) else
if {@Silo} = "Deployment" and isnull({HPD_HELPDESK.ROOT_CAUSE}) then
rgb(153,204,255) else
if {@Silo} = "Server Farm/Storageand isnull({HPD_HELPDESK.ROOT_CAUSE}) then
rgb(153,255,0) else
if {@Silo} = "Business" and isnull({HPD_HELPDESK.ROOT_CAUSE}) then
rgb(204,153,204) else
crwhite
 
I have a similar formula for coloring the background of my text field. But I use color (255,20,147). Could it be that you need to use the word color instead of rgb?
 
Definately follow "Knitwit" suggestion
remove the "RGB" and replace with the word "color"
 
The problem you are having is that a null value isn't "there" to be colored. Try placing {HPD_HELPDESK.ROOT_CAUSE} in a text box and then use your formula for the conditional background color. You could also simplify your formula to:

if isnull({HPD_HELPDESK.ROOT_CAUSE}) then
(if {@Silo} = "Services" then
rgb(153,204,204)) else
(if {@Silo} = "Infrastructure" then
rgb(204,204,153)) else
(if {@Silo} = "Information Assurance" then
rgb(153,255,255)) else
(if {@Silo} = "Win2K" then
rgb(255,255,204)) else
(if {@Silo} = "Messaging" then
rgb(255,204,204)) else
(if {@Silo} = "EMS" then
rgb(102,102,102)) else
(if {@Silo} = "Deployment" then
rgb(153,204,255)) else
(if {@Silo} = "Server Farm/Storage then
rgb(153,255,0)) else
(if {@Silo} = "Business" then
rgb(204,153,204)) else
crwhite

-LB
 
Thank you all for the suggestions. COLOR is incorrect in this form of use. RGB is correct. The text field option worked. And it worked beautifully. I tried your suggestion of shortening the code, but I could not get it to work. After the second else it kept telling me the rest was not part of the sentence. Or something to that effect. I tried omitting line by line to no avail. So I went back to the long hand. But you did teach me something new about nesting if's. I'm new to CR and learning my way through. Thank you everyone for all of your help. Tek-tips is the best! Thanks again.

 
Sorry, I think it should have been:

if isnull({HPD_HELPDESK.ROOT_CAUSE}) then
(
if {@Silo} = "Services" then
rgb(153,204,204) else
if {@Silo} = "Infrastructure" then
rgb(204,204,153) else
if {@Silo} = "Information Assurance" then
rgb(153,255,255) else
if {@Silo} = "Win2K" then
rgb(255,255,204) else
if {@Silo} = "Messaging" then
rgb(255,204,204) else
if {@Silo} = "EMS" then
rgb(102,102,102) else
if {@Silo} = "Deployment" then
rgb(153,204,255) else
if {@Silo} = "Server Farm/Storage then
rgb(153,255,0) else
if {@Silo} = "Business" then
rgb(204,153,204) else
crwhite
)
else crwhite

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top