开发者

An SQL statement into SSRS

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜