IIF声明的行为不符合预期

时间:2018-11-28 11:46:35

标签: c# reporting-services ssrs-2012 rdlc

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

我在报告中有上述声明,如果为date value is NULL,则它将返回“某些文本”,但是当我得到date时,返回的不是date field has a value {1}}

我对表达式的理解是,如果满足条件,则返回“某些文本”,否则返回#error

为什么会出现错误?

1 个答案:

答案 0 :(得分:2)

这样做

=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 :应为Boolean Expression
  • Paremeter2 :当Expressiontrue时将返回此值。
  • Paremeter3 :当Expressionfalse时,将返回此值。