Ibanez1408
Ibanez1408

Reputation: 5078

Changing background row color in reportviewer based on date

There are multiple answers on how to change the background color of a row in a report viewer based on a column value. I actually used one like so:

=Iif(Fields!Age.Value <= 15, "LimeGreen", 
Iif(Fields!Age.Value <= 30, "Blue", 
Iif(Fields!Age.Value <=45, "Yellow", 
Iif(Fields!Age.Value <=60, "Brown", "Red"))))

But what I want right now is to change the background color to light blue as soon as a date is greater than November 30, 2015 Thanks!

Upvotes: 0

Views: 1468

Answers (1)

alejandro zuleta
alejandro zuleta

Reputation: 14108

Try using Switch statement:

=Switch(
Fields!Date.Value > CDATE("2015-11-30"),"Light Blue",
Fields!Age.Value <= 15, "LimeGreen",
Fields!Age.Value <= 30, "Blue",
Fields!Age.Value <= 45, "Yellow",
Fields!Age.Value <= 60, "Brown",
true, "Red"
)

Let me know if this helps you.

Upvotes: 2

Related Questions