• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3435
  • Last Modified:

SSRS Switch to evaluate

I'm trying to use Switch to color code cells on a report.  I'm trying to evaluate a string and color code a "days outstanding" cell if the number of days exceeds a threshold.  Currently I get the following error:

[rsRuntimeErrorInExpression] The BackgroundColor expression for the text box ‘Textbox49’ contains an error: Argument 'VarExpr' is not a valid value.

I'm using the Switch expression since I'll have about 10 different values to compare.

=Switch(Fields!String1.Value = "Bank of America" and DateDiff("d", today(), Fields!Date1.Value)*-1 >14, "Red", "Transparent")

Open in new window

1 Solution
ValentinoVBI ConsultantCommented:
The Switch statement needs an even number of arguments.  See also: http://www.experts-exchange.com/A_2279.html

See snippet for a possible correction to your statement.
=Switch(Fields!String1.Value = "Bank of America" and DateDiff("d", today(), Fields!Date1.Value)*-1 >14, "Red", True, "Transparent")

Open in new window

mlehnenAuthor Commented:
That worked perfectly by adding the additional argument.  Thank you!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now