Report Builder 3.0 SWITCH expression DEFAULT/ELSE

二次信任 提交于 2019-12-02 20:03:32

There is no default clause in the SSRS Switch expression.

However, you can always modify your expression slightly:

=Switch 
(
  Parameters!UserFranNr.Value = "99","ID99",
  Parameters!UserFranNr.Value = "87","ID87",
  true, "ID0"
)

Since any time the last condition is hit it will be explicitly evaluated to true, the last row will effectively act as a default value.

I've used this in the past without issues. Other than perhaps generating frowns in people who read the expression, it works perfectly well with minimal effort.

As to whether it's sensible behaviour to have no default clause, well, that's a question for Microsoft. It certainly seems odd to me, but there you go.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!