Gossamer Forum
Home : Products : DBMan : Customization :

Color Coding using "if"

Quote Reply
Color Coding using "if"
I'd like to color code my search results so that the bg color of a table would changed based on the category it was in. I'm sure it could be done using some kind of "if" command, but I have no idea how to do it.

Has this been done before? If so, would someone be so kind as to point me to the instructions?

If it hasn't been done, is it even possible?
Quote Reply
Re: [shalom777] Color Coding using "if" In reply to
Are you using auto-generate?

If so... it will be kinda hard to do.

If not... use the following format:

if ($rec{'CategoryName'} eq "whatever") {print qq|bg color="red"|;}

example
Code:
<table border="0" |;
if ($rec{'CategoryName'} eq "whatever") {print qq|bg color="red"|;}
if ($rec{'CategoryName'} eq "something") {print qq|bg color="blue"|;}
if ($rec{'CategoryName'} eq "another") {print qq|bg color="green"|;}
print qq| cellpadding="0" cellspacing="0"><tr><td>

There's more compact ways to say the same thing, but you get the general idea.
Quote Reply
Re: [Watts] Color Coding using "if" In reply to
Beautiful! That worked perfectly. I'd show you, but this is running on my companies intranet.