以日期为条件的 SSRS 总是显示错误

SSRS conditional on Date always show error

我被阻止了,因为条件正在评估语句的两边:

=IIF(IsNothing(Fields!CancelDate.Value), Nothing, Fields!CancelDate.Value.ToLocalTime())

当 CancelDate 没有值时,我希望有空字段,但由于 ToLocalTime(),它中断了。

有没有人遇到过这样的事情?

尝试将 Nothing 更改为 " "

=IIF(IsNothing(Fields!CancelDate.Value), " ", Fields!CancelDate.Value.ToLocalTime())

您可以像这样在条件语句中使用本地时间转换:

=IIf(IsNothing(Fields!CancelDate.Value), Nothing, CDate(IIf(IsNothing(Fields!CancelDate.Value), Nothing, Fields!CancelDate.Value)).ToLocalTime())

这可能会被简化,但它确实有效。