reporting-servicesfieldcellbackground-colorssrs-expression

SSRS Field Expression to change the background color of the Cell


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!


Solution

  • 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