Question

Lets say we have this report with columns a, b, c, d, e, f.

We have some users that want to sort the data by columns a, b, c. Others by columns c, f, e. Others by columns d, a, c. others by column c. And one other group that constantly changes on how they want to sort the data.

Is there a way to get the user sort to order the columns based on which ones they click on. Say if the user clicks d, a, c the data will be ordered by d, a, c and not just the last column they click on? Also we want to achieve this in Report Builder 3.0.

Thank You

Was it helpful?

Solution

SSRS will hapily convert text into column names.

You can set up parameters like so (using the field names from your dataset as values):

 Name: Sort1


 Available Values:
 Label    Value
 ======   =======
 a        a
 b        b
 c        c
 d        d

One for each sort you may need. It sounds like 3 sort parameters will do you.

Then, in the sort section of your tablix (or table):

 Column
 ===============================
 Sort By: Parameters!Sort1.Value
 Then by: Parameters!Sort2.Value
 Then by: Parameters!Sort3.Value

Beware your parameter values need to be in the same case as the field names, but your labels can be anything you like.

OTHER TIPS

You can sort on multiple columns by holding SHIFT while clicking on column headers. This is not necessary for the first column you click on. Click on a sorting column header again while holding SHIFT to change the sort direction. You can mix sorting columns ascending and descending, respectively. This works in Report Builder (program) as well as Report Manager (web front end). The latter does not work in Firefox (30) (only single column sort), but does work in Internet Explorer (11) and Chrome (35). I use Report Builder 3.0 and SQL Server 2008 R2.

There is a way to allow the user sort to order of the data per column. I have not seen it documented much so here is my two bits worth. The results of this adds a little up/down icon over each column you put it on.

In Report Builder 3.0 when I drag a field property onto the grid, 3 rows show in that new column. When the grid has focus there is a grey row added above which is not where this is set.

If you right-click on the first white row, you should open "Text box properties".

In the dialog box, pick "Interactive Sorting".

  1. Check the Enable...
  2. Detail rows
  3. Sort by: drop-down pick the field in that column. Press [OK] for that Text Box.

Repeat this for all columns. Save the builder and run the report. The user can sort ascending or desc. at will.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top