简体   繁体   English

在SSRS 2008中的转换表达式中使用AND(请不要使用嵌套的IIF语句)

[英]Using AND in Switch Expression in SSRS 2008 ( no nested IIF statement please)

In my ssrs Chart ihave two groupings category and series grouping and i have four block of chart, in each block i have different color: 在我的ssrs Chart中,我有两个分组类别和系列分组,并且我有四个图表块,在每个块中,我有不同的颜色:

My question is how to say that in switch statement: 我的问题是在switch语句中怎么说:

=SWITCH(Fields!Code.Value="somthing" and Fields!Grp.Value="ThisRelateToSomthing", "Red",
Fields!Code.Value="somthingElse" and Fields!Grp.Value="ThisRelateToSomthingElse", "Blue")

Thank you 谢谢

For the SWITCH statement, the first argument can be any boolean expression, so it's perfectly fine to use multiple statements linked by and / or as long as true or false is returned. 对于SWITCH语句中,第一个参数可以是任何布尔表达式,所以这是完全正常使用的连接多条语句and / or只要truefalse返回。

If the expression evaluates to true , it will return the associated constant in the second argument, if not it will move on to the next statement until one evaluates to true or there are no more to check. 如果表达式的计算结果为true ,它将在第二个参数中返回关联的常量,否则将继续执行下一条语句,直到一个计算结果为true或没有更多要检查的内容为止。

So the SWITCH statement in your question looks fine as it is. 因此,您的问题中的SWITCH语句看起来不错。 You should just give it a try and see if it works. 您应该尝试一下,看看是否可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM