我的要求-如果条件满足,则ID栏应为蓝色,否则为黑色
蓝色= type =“ NY”和isact = true和eqe = true
蓝色= type =“ CAL”和isact = true
黑色= type =“ NY”且isact = false和eqe = false
黑色= type =“ NY”和isact = false和eqe = true
黑色= type =“ NY”并且isact = true和eqe = false
黑色= type =“ CAL”和isact = false
=IIf(Fields!IsAct.Value = True,
IIf(Fields!EQE.Value = True,
IIf(Fields!Type.Value = "NY", "Blue","Black"),"Black"), "Black")
or
IIf(Fields!IsAct.Value = False,
IIf(Fields!Type.Value = "CAL", "Black","Blue"), "Black")
我在字体ID列中有此逻辑。如果我在上面单独运行,那么它可以工作,但是如果我结合起来它不能工作。任何帮助都非常感谢。
这看起来非常复杂,我认为有一种更干净的方法可以使用SWITCH
语句来执行此操作。我相信以下表达式应该可以正常工作。
=SWITCH(
Fields!Type.Value = "NY" AND Fields!IsAct.Value AND Fields!EQE.Value, "Blue",
Fields!Type.Value = "CAL" AND Fields!IsAct.Value, "Blue",
Fields!Type.Value = "CAL" AND NOT Fields!IsAct.Value, "Blue",
Fields!Type.Value = "NY" AND NOT Fields!IsAct.Value AND NOT Fields!EQE.Value, "Black",
Fields!Type.Value = "NY" AND NOT Fields!IsAct.Value AND Fields!EQE.Value, "Black",
Fields!Type.Value = "NY" AND Fields!IsAct.Value AND NOT Fields!EQE.Value, "Black",
True, "Black")
因此,我认为表达式可以处理您提供的所有情况,但是如果我正确阅读,您实际上只有3个条件将颜色设置为蓝色,否则为黑色。所以以下内容也应该工作。
= IIF((Fields!Type.Value = "NY" AND Fields!IsAct.Value AND Fields!EQE.Value)
OR (Fields!Type.Value = "CAL" AND NOT IsNothing(Fields!IsAct.Value)), "Blue", "Black")