在 ssrs 中组合 IIF 语句

Combining IIF statements in ssrs

我试图在 SSRS 中组合以下 IIF 语句,但似乎无法使代码正确到 运行。有人可以帮忙吗?

=Iif(IsNothing(Fields!Description.Value) 和字段!CallFlag.Value = "1" , "New Record to Dial", 字段!Description.Value, Iif(IsNothing(Fields!Description.Value) 和 fields!CallFlag.Value = "0" , "Do Not Call", Fields!Description.Value, Iif(IsNothing(Fields!Description.Value) and isnothing(fields!CallFlag.Value), "Load Reject", Fields!Description.Value)

IIF 语句读取 IIF(boolean, TRUE-value, FALSE-value)。在您的情况下,您的意思是:if callflag=1 then "New Record" else if callflag=2 then.......

这将导致:

=Iif(IsNothing(Fields!Description.Value) and fields!CallFlag.Value = "1" ,
  "New Record to Dial", 
  Iif(IsNothing(Fields!Description.Value) and fields!CallFlag.Value = "0" ,
    "Do Not Call", 
    Iif(IsNothing(Fields!Description.Value) and isnothing(fields!CallFlag.Value),  
      "Load Reject", 
      Fields!Description.Value
    )
  )
)

如果您重新配置,您会得到:

=Iif(IsNothing(Fields!Description.Value) and fields!CallFlag.Value = "1" ,
  "New Record to Dial", 
  Iif(IsNothing(Fields!Description.Value) 
    iif(isnothing(fields!CallFlag.Value), "Load Reject",
      Iif(fields!CallFlag.Value = "0" ,   "Do Not Call", 
        Iif(fields!CallFlag.Value = "1" ,   "New Record to Dial", "Error on CallFlag Value")
      )
    )
 , Fields!Description.Value)

甚至更好:如果您使用 SQL-server 作为标签指示,请使用 CASE 命令... CASE command in SQL