=IIF(Fields!Date.Value = "", "Some Text", Fields!Date.Value)
我在报告中使用了以上语句,如果日期值为空
,则返回"一些文本",但是如果日期字段有值
,而不是返回日期
,我得到了#error
。
我的理解是,如果满足条件,则返回"一些文本",否则返回Fields!Date.Value
。
为什么会出现错误呢?
=IIF(Fields!Date.Value = "", "Some Text", Fields!Date.Value)
我在报告中使用了以上语句,如果日期值为空
,则返回"一些文本",但是如果日期字段有值
,而不是返回日期
,我得到了#error
。
我的理解是,如果满足条件,则返回"一些文本",否则返回Fields!Date.Value
。
为什么会出现错误呢?
这样做就可以了
=IIF(Fields!Date.Value Is Nothing, "No Value", Fields!Date.Value)
IIF()
语句的格式如下:
=IIF( Expression to evaluate,
what-to-do when the expression is true,
what-to-do when the expression is false )
Parameter1
: 应该是一个布尔表达式。Paremeter2
: 当 Expression
为 true
时,将返回此值。Paremeter3
: 当 Expression
为 false
时,将返回此值。