Share via


SSRS: Converting Between Tablix Controls (Matrix, Table, List)

Introduction

Depending on the version of SSRS you are using, you may have found that when you add a table to your report, the control name defaults to TablixY where Y is a number. Likewise, when adding a Matrix or List the default name for the control will be in the format, TablixY. SSRS does not seem to recognize that these are different controls. The reason for this is… they aren't. All three are the same control, a Tablix.

Overview

With the release of SSRS 2008, the separate table-like controls were unified into a single control called the Tablix along with three templates for the new unified control. The three templates are the Table, the Matrix and the List. While the initial appearance of each of the variations is different, there are obvious similarities. All three allow for row groups and they allow for detail cells that are scoped to their associated group(s). They all allow for column headers. They allow you to add totals to groups before or after the detail cells. The list goes on and on. There are far more similarities than differences. I suppose you could say that the proof is in the pudding. If, in fact, all three are the same control then I should be able to start with any of the three templates and convert it to either of the others. So let's look at how we can do that.

Converting the Table

Beginning with a Table, we will convert it to both a Matrix and List. Add a Table to your report or select an existing Table. Converting the Table to a List is the simplest conversion. Right-click any detail cell to open the context menu. Choose Insert (not Insert Column or Insert Row) and select Rectangle. You now have a List control. It is true that this List control looks different than the List created from the Insert menu but if you like you can make it exactly the same by deleting the header row and any extra detail cells. Then just adjust height and width to make it look identical to the out-of-box template. 

To convert the Table into a Matrix, start with the original Table (before we converted it to a list) and right-click a detail cell to open the context menu. Now hover over "Add Group" and under the Column Group heading of the fly out menu choose Parent Group. Voila! A Matrix is born. Again, it is not identical to the out-of-box Matrix but with some slight tweaks it can be. Add a new row group (and delete the existing unassigned group if desired) to get the left row group column. Delete the extra detail Cells and the header row. Now adjust your heights and your widths and you are done.

Converting the List

While a List begins with a single detail cell, the Table typically starts with three columns, a header row, a Textbox in each detail cell and one row group, called Details, with no grouping field specified. To convert the List to a Table, start by first deleting the Rectangle in the single detail cell. The Tablix control will automatically insert a Textbox in its place. The list already starts with an unassigned row group, like the Table, so we just need to add the header row and the additional detail cells. The simplest means of doing this is to simply insert a row outside and above the group row. Alternately, add a parent group to the existing details group and select the checkbox for "Add group header". If you haven't assigned a dataset to the List yet, you can group on an expression (like =1). Now delete the newly created group and associated column and you are left with a single detail cell with a header. All that remains is to right-click the column selector and insert a column either left or right to add an additional column. Repeat to add the third and it is just a matter of setting row height and column widths to make your converted List look exactly like a freshly inserted Table.

To convert the newly created Table to a Matrix, simply perform the steps described above for converting a Table to a Matrix.

Converting the Matrix

The last piece is to convert a Matrix to a List and a Table. This is pretty simple as well. For the most part we just need to delete things to do this conversion. First, delete the column group including the associated rows and columns. Now delete the first column and insert a Rectangle into the single remaining detail cell and you have a List.

Follow the steps above to convert the newly created List to a Table to complete the Matrix transformation.

Summary

By understanding the Tablix, you can easily convert between Tablix types, saving both time and effort, as well as combine features to create new variations such as a Matrix List. With this understanding, you are better prepared to create and modify SSRS reports.


See Also

  • [[SQL Server Reporting Services Portal]]