Groups | Blog | Home
all groups > sql server reporting services > may 2007 >

sql server reporting services : sql CASE equivlanet in srs expressions?


Chris Patten
5/22/2007 12:17:00 PM
Is there a sql equivalent to CASE in srs expressions? I have a field which
can return a value of 1-10, and based the the value I want to display some
text. I know how to do the case in sql, but would prefer to do it in SRS if
possible as I have about 12 fields like this and don't want sql to get messy.
Thoughts?

Reeves Smith
5/22/2007 1:44:00 PM
Switch

Hard to say on performance, SQL will probally be faster in that it can
restrict your set before it sends, but if you are talking about small sets I
think it is very minor.

Reeves


[quoted text, click to view]
EMartinez
5/22/2007 6:26:39 PM
On May 22, 3:44 pm, Reeves Smith
[quoted text, click to view]

I agree w/Reeves. However, you should look into the 'switch' keyword
for an expression. Here is the format:
=switch(Fields!FieldNameValue.Value = "Value1","Value/FormatIfTrue1",
Fields!FieldNameValue.Value = "Value2", "Value/FormatIfTrue2", ...,
true (all others), "DefaultValue/Format")
Hope this helps.

Regards,

Enrique Martinez
Sr. Software Consultant
AddThis Social Bookmark Button