R_Avery_17
R_Avery_17

Reputation: 305

IIF statement not behaving as expected

=IIF(Fields!Date.Value = "", "Some Text", Fields!Date.Value)

I have the above statement in a report, and if the date value is NULL, then this will return "Some Text", however instead of returning the date when the date field has a value i get #error

My understanding of the expression is that if the condition is met return "Some Text" otherwise return Fields!Date.Value

Why do I get an error?

Upvotes: 3

Views: 237

Answers (1)

ArunPratap
ArunPratap

Reputation: 5020

Do that like this

=IIF(Fields!Date.Value Is Nothing, "No Value", Fields!Date.Value)

The IIF() statement has the following format:

=IIF( Expression to evaluate,
         what-to-do when the expression is true,
         what-to-do when the expression is false )
  • Parameter1: It should be a Boolean Expression.
  • Paremeter2: This value will return when Expression is true.
  • Paremeter3: This value will return when Expression is false.

Upvotes: 2

Related Questions