Reputation: 815
I am working on an expression for SSRS to change background cell colours. I keep getting an error On the second IIF statement and I have no idea why, maybe someone can spot an error i made?
This was the original expression i made... Which worked great,
=IIF((Fields!DriveLetter.Value = "F:" OR Fields!DriveLetter.Value = "T:") AND (Fields!FileType.Value = "MDF" OR Fields!FileType.Value = "NDF"), "Lime",
IIF((Fields!DriveLetter.Value = "G:" OR Fields!DriveLetter.Value = "U:") AND (Fields!FileType.Value = "LDF"), "Lime", "Tomato") )
I added one more IIF statement with added logic and that caused the error. I kept playing with it but couldnt get the error to go.
=IIF((Fields!DriveLetter.Value = "F:" OR Fields!DriveLetter.Value = "T:") AND (Fields!FileType.Value = "MDF" OR Fields!FileType.Value = "NDF"), "Green",
IIF(Fields!DriveLetter.Value = "G:" OR Fields!DriveLetter.Value = "U:") AND (Fields!FileType.Value = "LDF"), "Green",
IIF(Fields!DriveLetter.Value = "C:") AND (Fields!Database_Name.Value = "master" OR Fields!Database_Name.Value = "model" OR Fields!Database_Name.Value = "msdb"
OR Fields!Database_Name.Value = "tempdb"), "Lime", "Red" )
Thanks.
Upvotes: 0
Views: 38
Reputation: 458
The hooks were not set correct:
IIF(((Fields!DriveLetter.Value = "F:" OR Fields!DriveLetter.Value = "T:") AND
(Fields!FileType.Value = "MDF" OR Fields!FileType.Value = "NDF")), "Green",
IIF(((Fields!DriveLetter.Value = "G:" OR Fields!DriveLetter.Value = "U:") AND
(Fields!FileType.Value = "LDF")), "Green", IIF(((Fields!DriveLetter.Value = "C:") AND
(Fields!Database_Name.Value = "master" OR Fields!Database_Name.Value = "model" OR
Fields!Database_Name.Value = "msdb" OR Fields!Database_Name.Value = "tempdb")), "Lime",
"Red" )))
Upvotes: 2