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!
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With