how to do sorting by option.
for example, if there are option like item1,item2,item3
if user click item1,the report should sort by item1,
In design go to Group properties, sorting, add -> put needed expression.
i dotn hv group in my report,what expression do i need to put
The expression on your sort should be something like this:
I believe what you need is dynamic sorting.
This can be done by selecting your header cell and go to Interactive Sort.
If this is not what you need, you may try this approach too.
i dnt need interactive sorting.
i have 1 multivalue param so when i run report
i m seeing option like
sort by : (1) account
so whatever option user select,repoirt should sort by that only.
my param like this
how to write expression in tablix ?
1.Go to Tablix Member properties (one of the way to get there is click on Row Groups icon in design mode)
2.Go to SortExpression and put something like that:
you got your solution in my last link.
Let's say your parameter is named Parameter!Sort. You say your parameter is multi value, for the formula below I will assume that you can only select one value at a time.
In the tablix dialog, sorting tab you can use an expression something like this:
=SWITCH(Parameter!Sort.Value = "act",Fields!Account.Value, Parameter!Sort.Value="mv",Fields!Market.Value, Parameter!Sort.Value = "NextSortValue", Fields.NextSortValue.Value)
i dont need interactive sorting
this is how its works
what i have done is in tablix propereties
i add expression for each field
its working ,but user can select sorting by multiple field,i want user can select only 1 filed by sorting
ok.thisa isnot working,i put expression and then desceding.
but without selection anything ,aqll fileds r desceding.
why it is like that
I couple friendly suggestions when posting to the forum.
These two suggestions will help others understand what it is that you are asking and save you and them time. We do this as a community because we love helping others come up with possible solutions their problems. Again, these are just friendly suggestions.
As for your problem, I would suggest passing this into a stored procedure as a parameter. Then I would create my query dynamically. I normally stay away from dynamic SQL, but this sounds like an optimal opportunity to pass multiple selected items to be used as a SORT. An example of a simple stored procedure might look like:
CREATE PROC DynamicSort
DECLARE @SQL NVARCHAR(MAX)
SET @SQL = 'SELECT ColumnList FROM TableName ORDER BY ' + @OrderBy
--now that you have your SQL set, execute it
EXEC sp_executesql @SQL