Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS Field Expression to change the background color of the Cell

Tags:

I'm trying to write a field expression for a Cell in my report where I have to change the background color of the cell depending on the string value in the cell. Ex: if the column has a value 'Approved' in it, the cell should show a green background color. I tried the following:

= IIF(fields!column.value = "Approved", "Green") 

and

= IIF(Fields!column.Value, "Approved", "Green") 

Neither works.. I know i'm missing something in the syntax.. Probably I'm not refering green to the back ground color in the syntax. Please help!

like image 484
Avinash Avatar asked Feb 14 '11 14:02

Avinash


2 Answers

The problem with IIF(Fields!column.Value = "Approved", "Green") is that you are missing the third parameter. The correct syntax is IIF( [some boolean expression], [result if boolean expression is true], [result if boolean is false])

Try this

=IIF(Fields!Column.Value = "Approved", "Green", "No Color") 

Here is a list of expression examples Expression Examples in Reporting Services

IIF in SSRS report

like image 60
dustyhoppe Avatar answered Oct 04 '22 22:10

dustyhoppe


Make use of using the Color and Backcolor Properties to write Expressions for your query. Add the following to the expression option for the color property that you want to cater for)

Example

=iif(fields!column.value = "Approved", "Green","<other color>") 

iif needs 3 values, first the relating Column, then the second is to handle the True and the third is to handle the False for the iif statement

like image 42
user2655481 Avatar answered Oct 04 '22 21:10

user2655481