Laser42
Laser42

Reputation: 744

How to use hex color value in SSRS

When I set custom color to some form in Expressions window, the formula looks like #117be0 or ="#117be0"

So, the question is, how to get string color hex value from dataset that contains the same value? Something like this =First(Fields!my_color.Value, "color_dataset")

Upvotes: 0

Views: 2214

Answers (1)

Lucky
Lucky

Reputation: 4493

Well, you kind of answered your own question. Yes, FIRST() will return the first value in the colors dataset. To make this more meaningful, you are going to want to used the LOOKUP function.

LOOKUP(Fields!Local_Dataset_Value.Value, Fields!Color_Dataset_Value.Value, Fields!my_color.Value, "color_dataset")

Lookup will check the value of the Local_Dataset_Value field in your current table dataset, and find a match for that value in the "color_dataset" dataset's Color_Dataset_Value field. When it finds a match, then your color will return.

To explain further, given datasets:

Dataset1

Name | Age | Etc

........................

Joe | 30 | Whatever

and

color_dataset

Color_Name | my_color

.....................

Joe | Blue

then:

LOOKUP(Fields!Name.Value, Fields!Color_Name.Value, Fields!my_color.Value, "color_dataset")

Would return:

"Blue"

Upvotes: 1

Related Questions