此表达式始终在我的报告上打印#Error
=IIF(ISNOTHING(Fields!f2.Value)," ", Fields!f2.Value* Fields!If3.Value)
答案 0 :(得分:0)
无论测试值如何,始终会评估IIF的参数。让我们分解表达式,看看会发生什么。
P1 = ISNOTHING(Fields!f2.Value) // this gets evaluated and "True" is the value
P2 = Fields!f2.Value * Fields!If3.Value // this gets evaluated and throws an #Error
Result = IIF(P1," ",P2) // this never gets evaluated because an error is already thrown
试试这个:
=IIF(ISNOTHING(Fields!f2.Value)," ", IIF(ISNOTHING(Fields!f2.Value),0, Fields!f2.Value) * Fields!If3.Value)
在这种情况下,当f2为空时,会发生以下情况:
P1 = ISNOTHING(Fields!f2.Value) // this gets evaluated and "True" is the value
P2 = IIF(P1,0, Fields!f2.Value) // this gets evaluated and 0 is the value
P3 = P2 * Fields!If3.Value // this gets evaluated and 0 is the value
Result = IIF(P1, " ", P3) // this gets evaluated and " " is the result