dynamic Sorting in SSRS
-
Tuesday, September 04, 2007 12:27 PM
Hi,
I needed a way to sort dynamically in a Reporting Services report by selecting a Column Name dynamically from a dropdown list.
Thanks
Prajith
All Replies
-
Tuesday, September 04, 2007 4:02 PM
Use a query type of text and do it this way:
= " SELECT <your query> ORDER BY " & @YourParam
... or use a query type of sproc and pass the param to the sproc...
No?
>L<
-
Wednesday, September 05, 2007 9:24 AM
Thanks for your information.
-
Thursday, September 06, 2007 10:57 AM
There is solution for ur problem.What you have to do is, create a parameter and provide values for it.
These values must be the column names of report.
Then use
=Fields(Parameters!.Value).Value
expression in Interactive sort tab.Here(Parameters!.Value) becomes ur selected parameter i,e field name.
then finally it becomes , =Fields!.xxxx.Value
Just u try this, u wil get.
Also u go through this article, search in google
Beginning SQL Server 2005 Reporting Services Part 2 -
Saturday, September 08, 2007 12:36 PM
Hi,
Thanks for your kind attention. I tried your method its working fine. But i have done it in different way. What i ahve done is passing a parameter to the query and inside the order by clause i have used as follows
ORDER
BY CASE WHEN @OrderBy = 'ColumnName' THEN TableName.ColumnName WHEN @OrderBy = 'ColumnName' THEN TableName.ColumnNameEND
by Prajith
-
Monday, September 10, 2007 1:31 AM
Yes -- this is the same as passing it to the sproc <s>.
FWIW you can do it with the interactive sort as your other response indicates as well -- the only thing you have to realize is that the result may not be any different. IOW, I believe the query is re-run in both cases, whether the user presses the "refresh report" button or uses the interactive sort feature. But I have not tested this.
Does anybody reading know for sure?
>L<

