Quantcast
Channel: SQL Server Reporting Services FAQ
Viewing all articles
Browse latest Browse all 158

SQL Server Reporting Services FAQ

$
0
0

Question 7: Does SQL Server 2005 Reporting Services support horizontal tables which have fixed rows and dynamic columns?

 

 

Answer:


Note: This Q&A is only for  SQL Server 2005 Reporting Services.


By default, there is no native "horizontal table" report item. We can use Matrix to simulate simple horizontal tables:

 

1.       Add a matrix to your report.

2.       Add static rows to the matrix: Right-click in the Data cell and select "Add Row".  Repeat for the number of fixed rows you want.

3.       Drag fields into the Data cells:

You'll notice that the design tool automatically wraps your field reference in the "First" aggregate (e.g. =First(Fields!City.Value)).  Since you're doing this in the context of a matrix, the design tool is ensuring that the expression is meaningful even in the context of a subtotal or if the matrix is showing aggregated data rather than detail data. 

 

Note: Please do NOT remove the aggregate expression.

4.       Add a column grouping:


1) Right-click on the column header and select "Edit Group". 

2) Enter this for the group expression: =RowNumber(Nothing). This will cause the matrix to give you one column per row of data. Since horizontal tables can end up rather wide, you may want your table wrap around to the next "line" after a specific number of columns.

 

5.       Add a list to your report and drag the table into it.

6.       Group by a number of rows:

1) Right-click on the list and select Properties.  Then click on Edit Details Group.
2) Enter this for the group expression: =Ceiling(RowNumber(Nothing)/3)

This will cause the list to group on every three rows.  So you'll get a separate table for every three rows.

 

7.       Adjust the group expression in the matrix:

Edit the column group expression in your matrix and change the RowNumber argument to be the list group name. For example: =RowNumber("list1_Details_Group")

 

More Information: SQL Server 2008 Reporting Services has a new Date Region control named Tablix, which can be used for the same requirement easily. For more information about Tablix, Please refer to the documents below:

 

What's New in Report Authoring

Report Definition Tablix Overview Diagram

Understanding the Tablix Data Region

Working with Tablix Data Regions


Microsoft Online Community Support

Viewing all articles
Browse latest Browse all 158

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>