Alborz
Alborz

Reputation: 2043

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:

My question is how to say that in switch statement:

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

Thank you

Upvotes: 1

Views: 8967

Answers (1)

Ian Preston
Ian Preston

Reputation: 39586

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.

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.

So the SWITCH statement in your question looks fine as it is. You should just give it a try and see if it works.

Upvotes: 2

Related Questions