cancel
Showing results for 
Search instead for 
Did you mean: 

Set the color of a field in Crystal Reports from another field

Former Member
0 Kudos

Hi,

I have Crystal Reports and I am trying to build a report where the color is defined within another file within the database. Here is an example:

I have create a table that contains a color eg:

No when i produce my report I want it to look like this:

How do I go about to achieve this. I know how to do a conditional format in Crystal Reports, but I cannot get it right to do a condition format where the color comes from the database.

Thanks in advance for your assistance.

Accepted Solutions (1)

Accepted Solutions (1)

ashrafsharaf
Participant
0 Kudos

How many colors do you have in that table of yours? if there aren't many you could create a formula as follows:

if {ColorField} = Red then crRed else

if {ColorField} = Yellow then crYellow

RGB will be a bit more complicated because you will need to extract the specific rgb numbers and truncate them so you can use them in the RGB() function. if it's possible to turn your table into 3 columns (R, G, and B) instead of just 1 color column then you can use this in the formula:

RGB({ColorTable.R},{ColorTable.G},{ColorTable.B})

Good luck,

Ashraf

Answers (1)

Answers (1)

0 Kudos

Added CR Tag.

Hit the F1 key in CR Designer and then search for Color....

Former Member
0 Kudos

Sorry Don, but i think you misunderstood.

I know how to add colors in easily, but what i want is a color that is defined in another column in the database.

In Visual Studio, i can set the backcolor for a text field by setting the backcolor to the database column, but how do i do it in my CR Reports for Visual Studio.

0 Kudos

Ah, CR for VS has a basic report designer. If you don't have that option suggested below then you'll have to get a full build of CR Designer and use it to modify your reports.

And Ashraf has the formula you would nee to use.