开发者

An SQL statement into SSRS

开发者 https://www.devze.com 2023-03-01 05:25 出处:网络
I tried to incorporate the following into SSRS but failed. If XXX = “A” th开发者_开发问答en display “AT”

I tried to incorporate the following into SSRS but failed.

If XXX = “A” th开发者_开发问答en display “AT”

Else if XXX = “B” then display “BEE”

Else if XXX = “C” then display “CAR”

Else display “Other”

I tried

=Switch(
  Fields!XXX.Value = "A", "AT", 
  Fields!XXX.Value = "B", "BEE",
  Fields!XXX.Value = "C", "CAR", "Other")


You almost had it. For every output in the Switch function must be paired with a condition. Just make your last condition evaluate to True.

=Switch(
  Fields!XXX.Value = "A", "AT", 
  Fields!XXX.Value = "B", "BEE",
  Fields!XXX.Value = "C", "CAR", 
  True, "Other"
)


You want something like this:

=iif(Fields!XXX.Value = "A", "AT", iif(Fields!XXX.Value = "B", "BEE", iif(Fields!XXX.Value = "C", "CAR", "Other")))

[check the parens in the expression builder]

0

精彩评论

暂无评论...
验证码 换一张
取 消