SQLTeam.com | Weblogs | Forums

Using Case statement in SSRS to display the data as per our wish


#1

In my SSRS report, I have a column that needs the data to be updated using a CASE / IIF / SWITCH statement expression.

Also, the data has been colored coded. So I want both the expressions to satisfy and give the output.

I used this, but not sure, if this is right....

=IIF
(
	Fields!ActivityDesc.Value = "EptSentDtTm" and Fields!ActivityDesc.Value = "RED", "OverDue","NULL"
)

Can anyone help me out here.
Its just like using a case statement in SQL, but I am not sure, as to how implement this directly in SSRS report itself.
Can we also chose the font color. If Red then blue......

Ex: If the value = "Sky" and value_color = "Black", "Sky Blue", "White"

Appreciate any help on this.
Thanks!


#2

Does it work?


#3

Gbritton,
I didn't test it, but wanted to. My question was, I want to implement a case statement in the column, but don't know where to include this logic?
I already have a "IIF" statement to change the color of the data.

Can you or anyone let me know as to where in the Properties window should I include the above case statement (Or IIF statement).


#4

OIC -- use an Expression for that. Also, the Switch expression matches the SQL CASE expression


#5

I implemented it in the "Tablix Properties" window under the Visibility - Show or hide based on an expression. Getting this error

" The hidden expression used in the tablix returned a data type that is not valid"


#6

OK -- so where have you put the expression? The error message indicates that SSRS expects a datatype other than string.


#7

In the Visibility section --- "Show or hide on an expression" , of the Tablix Properties window.


#8

Needs to return a boolean value: True or False


#9

Didn't quite get you? Am I using the expression in the correct place? Or is there any other place that I have to use this Expression?


#10

Your expression is returning "OverDue","NULL", but it should return True or False. OTOH perhaps you have put the expression in the wrong place.


#11

The expression say's; (that I am using is)
If the value is "A" AND "RED", then change it to "B", else "Null"

Where do you think should I use it, so that when I Preview the report, it should display the data as per my expression.