【问题标题】:IIF statement not behaving as expectedIIF 语句未按预期运行
【发布时间】:2018-11-28 11:46:34
【问题描述】:
=IIF(Fields!Date.Value = "", "Some Text", Fields!Date.Value)
我在报告中有上述声明,如果date value is NULL,那么这将返回“一些文本”,但是当date field has a value 我得到#error 时,而不是返回date
我对表达式的理解是,如果满足条件返回“Some Text”,否则返回Fields!Date.Value
为什么会出错?
【问题讨论】:
标签:
c#
reporting-services
ssrs-2012
rdlc
【解决方案1】:
这样做
=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:当Expression 为true 时将返回此值。
-
Paremeter3:当Expression 为false 时,将返回此值。