In SQL Server Reporting Services, Sorting is similar to SQL ORDER BY Clause. Interactive Sorting is used to provide the sorting control to end-user like we see in popular e-commerce websites like Amazon. Interactive Sorting provides Up & Down arrows to toggle between Ascending Order and Descending order.
In this article we will show you, How to enable Interactive Sorting (Sorting data at Text box level) in SQL Server Reporting Services 2014 with example.
TIP: It is always better to apply Sorting at Texbox level (Interactive Sorting) only because it will allow the user to dynamically sort the records.
We are going to use below shown report to explain, Interactive Sorting in SSRS Reports. Please refer SSRS Table Report article to understand the Data Source and Dataset we used for this report. If you observe the below screenshot, It was a normal report with Product Name, Color, Sales Amount and Tax Amount columns.
If you observe the above screenshot, it is displaying the data in a unsorted manner.
Interactive Sorting in SSRS 2014
Select the Header Textbox of the SSRS report and Right click on it will open the context menu. Please select the Text Box Properties.. option from it
Once we click on the Text Box Properties.. option, a new Text box Properties window will be opened. Please select the Interactive Sorting tab as shown in below screenshot.
Click on the Add button will display the below properties
- Enable interactive sorting on this text box: If you want to enable the interactive sorting on this selected text box then please select this option as shown in below screenshot .
- Detail Row: If you want to enable the interactive sorting on Details Row then please select this option.
- Groups: If you want to enable the interactive sorting on Grouping Column then please select this option.
- Sort by: It will allow you to select the available Column from the Dataset or we can create our own Expression by clicking the fx button. For instance, If you want to sort the data by Product Name then select that column name.
NOTE: Interactive Sorting is applied to individual Columns. If you select wrong column asSort By then you may end up with wrong results. For instance, you enabled the Interactive Sorting on Product Name and assigned Color column as Sort by. If this is the case then, when you click on Product name data will be sorted by color instead of Product Name.
In this example, We are going to apply interactive Sorting on [English Product Name] so, Please select the [English Product Name] as Sort By Expression.
Click Ok button to finish enabling Interactive Sorting for the Product name. Let us Preview the Report
If you observe the above screenshot, data is sorted by the Product Name in the Ascending Order.
Let us click the down arrow to sort the data in Descending order
Let us enable the Interactive Sorting for the remaining columns such as Color, Sales Amount and Tax Amount using above mentioned steps and see the preview
This is how, We can provide the Dynamic sorting option to end users.
Thank You for Visiting Our Blog