IIF 声明未按预期运行

IIF statement not behaving as expected

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

我在报告中有上述声明,如果 date value is NULL,那么这将 return "Some Text",但是 return 不是 [=12] =] 当 date field has a value 我得到 #error

我对表达式的理解是如果条件满足return"Some Text"否则returnFields!Date.Value

为什么会出现错误?

像这样

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

IIF()语句有如下format

=IIF( Expression to evaluate,
         what-to-do when the expression is true,
         what-to-do when the expression is false )
  • Parameter1:应该是BooleanExpression
  • Paremeter2:当Expressiontrue时,该值将return。
  • Paremeter3:当Expressionfalse时,此值将return。