axlrose89
axlrose89

Reputation: 37

SSRS hide #Error

I am getting an #Error on some cells after using the following expression, any ideas what's wrong with it?

=iif(Fields!PercentageCompleted.Value >= (ReportItems!ExpectedComplPercentage.Value) * 100, "Yes", "")

Upvotes: 0

Views: 1106

Answers (1)

Lucky
Lucky

Reputation: 4493

The #Error code is a compiler error usually resulting in a type mismatch. If you have a value in one of those fields that VB.NET interprets as a string, it can't do a mathematical comparison and thus you get an error.

To fix this, use the CINT (integer) or CDEC (decimal) functions to cast the values to the data type you want. For reference, CSTR converts to string and CDATE to a date if you're trying to compare those later down the line.

=iif(CDEC(Fields!PercentageCompleted.Value) >= CDEC(ReportItems!ExpectedComplPercentage.Value) * 100, "Yes", "")

Note: I recommend you cast data types in your expressions pretty much all of the time to avoid problems.

Upvotes: 1

Related Questions