我正在研究基于 window 的报告应用程序。我在 运行 时间遇到#Error,此时值将为“*”

I am working on window based report application. I am facing #Error at run time when value will "*"

=IIf((First(Fields!CIPDetergentRep.Value) Is Nothing AND First(Fields!CIPDetergentSelect.Value) Is Nothing)
        ,"" , IIf((First(Fields!CIPDetergentRep.Value) AND First(Fields!CIPDetergentSelect.Value) Is Nothing)
            ,"" , IIf((First(Fields!CIPDetergentRep.Value) Is Nothing AND First(Fields!CIPDetergentSelect.Value))
                ,"NOT SELECTED", IIf((First(Fields!CIPDetergentRep.Value) ="") OrElse (First(Fields!CIPDetergentSelect.Value) = "")
                    , "-" , IIf((First(Fields!CIPDetergentRep.Value) ="*") OrElse (First(Fields!CIPDetergentSelect.Value) = "*")
                        ,"*", IIf((First(Fields!CIPDetergentRep.Value) ="1" AND First(Fields!CIPDetergentSelect.Value) = "1")
                            ,Code.ChangeWord(First(Fields!CIPDetergentLevel.Value)), "NOT SELECTED"
                        )
                    )
                )
            )
        )
    )

你有 2 个表达式 return 没有任何布尔值

当您想检查一个字段 return 的值时,请使用像 Not(Field.Value Is Nothing)FieldValue IsNot Nothing

这样的表达式

另外我建议使用 Switch 而不是嵌套的 Iif 来提高可读性

=Switch(
    First(Fields!CIPDetergentRep.Value) Is Nothing And First(Fields!CIPDetergentSelect.Value) Is Nothing, "",
    First(Fields!CIPDetergentRep.Value) IsNot Nothing And First(Fields!CIPDetergentSelect.Value) Is Nothing ,"",
    First(Fields!CIPDetergentRep.Value) Is Nothing And First(Fields!CIPDetergentSelect.Value)  IsNot Nothing ,"NOT SELECTED",
    First(Fields!CIPDetergentRep.Value) ="" Or First(Fields!CIPDetergentSelect.Value) = ""  , "-",
    First(Fields!CIPDetergentRep.Value) ="*" Or First(Fields!CIPDetergentSelect.Value) = "*"  ,"*",
    First(Fields!CIPDetergentRep.Value) ="1" And First(Fields!CIPDetergentSelect.Value) = "1"  ,Code.ChangeWord(First(Fields!CIPDetergentLevel.Value)), 
    True, "NOT SELECTED"
)   
    =IIf((First(Fields!CIPDetergentSelect.Value) Is Nothing)
        ,"" , IIf((First(Fields!CIPDetergentRep.Value) Is Nothing)
            ,"NOT SELECTED", IIf((First(Fields!CIPDetergentRep.Value) ="") Or First(Fields!CIPDetergentSelect.Value) = "")
                , "-" , IIf((First(Fields!CIPDetergentRep.Value) ="*") Or (First(Fields!CIPDetergentSelect.Value) = "*")
                    ,"*", IIf((First(Fields!CIPDetergentRep.Value) ="1" AND First(Fields!CIPDetergentSelect.Value) = "1")
                        ,Code.ChangeWord(First(Fields!CIPDetergentLevel.Value)), "NOT SELECTED"
                    )
                )
            )
        )
 )