在iif语句上连接字符串和字段

问题描述 投票:0回答:2

我有一个SSRS计算字段,我可以连接字符串和字段。我怎样才能使用&。最好的方法是什么?

=iif(Fields!TYPE.Value= "A", "participated in" &Fields!NAME.Value& "'s game",
iif(Fields!TYPE.Value= "N", "did not participate in" & Fields!NAME.Value & "'s game",
"###ERROR###"
))

参加帕特里克的比赛或没有参加帕特里克的比赛

reporting-services ssrs-2008
2个回答
0
投票

试试以下

 =IIF(Fields!TYPE.Value= "A", "participated in" AND Fields!NAME.Value= "'s game",
    IIF(Fields!TYPE.Value= "N", "did not participate in" AND Fields!NAME.Value="'s game",
    "###ERROR###",nothing ),nothing)

0
投票

&是正确的方式,连接字符串,你只是错过了第一和第二&的几个空格:

=IIF(Fields!TYPE.Value= "A", 
     "Participated in " & Fields!NAME.Value & "'s game",
          IIF(Fields!TYPE.Value= "N", 
              "Did not participate in " & Fields!NAME.Value & "'s game",
              "###ERROR###"
              )
      )
© www.soinside.com 2019 - 2024. All rights reserved.