结合ssrs

时间:2016-11-10 12:31:51

标签: sql-server reporting-services sql-server-data-tools

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

= Iif(IsNothing(Fields!Description.Value)和字段!CallFlag.Value =“1”,“拨打新记录”,字段!Description.Value, Iif(IsNothing(Fields!Description.Value)和fields!CallFlag.Value =“0”,“Do Not Call”,Fields!Description.Value, Iif(IsNothing(Fields!Description.Value)和isnothing(fields!CallFlag.Value),“Load Reject”,Fields!Description.Value)

1 个答案:

答案 0 :(得分:1)

IIF语句读取IIF(布尔值,TRUE值,FALSE值)。在你的情况下你的意思是:如果callflag = 1那么“新记录”,否则如果callflag = 2则.......

这会导致:

=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