Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 28687

Forum FAQ: How do I achieve column break in a matrix?

$
0
0

Symptom

Although you can set page break for column group in Reporting Services 2008, page breaks are ignored on column groups. Reference:

http://msdn.microsoft.com/en-us/library/ms156434.aspx

Solution

Here are some workarounds, available forboth Reporting Services 2005 and2008:

Workaround 1

Spread the columns from one matrix into several matrixes. You can first copy one matrix and then paste it into several ones you want. Then set the filter for each column group to make sure that the total columns’ length in one matrix just fit a page’s width.

Workaround 2

The other method is to use a custom code.

a.     Please copy the following code to the custom code area:

Dim FlagTable As System.Collections.Hashtable

Dim Flag AS Integer

 Function MyFunc(ByVal NewValue As Object) As Integer

If (FlagTable Is Nothing) Then

FlagTable = New System.Collections.Hashtable

End If

If (NewValue Is Nothing) Then

NewValue = "-"

End If

If (Not FlagTable .Contains(NewValue )) Then

Flag =Flag + 1

FlagTable.Add(NewValue, nothing)

End If

MyFunc = Flag

End Function

b.     Create a list in your report.

Imagine thatthe column group of a matrix is grouped bythe field ‘Column_Group’, then set the detail group of list withthe expression like this:

=Ceiling(Code.MyFunc(Fields!Column_Group.Value)/5)

Note: This means the Max number of column in matrix will be five after you follow step C.

c.      Sort the dataset by column group field, and then drag the matrix into the list. Click Preview.

Workaround 3

Similar to the second method, you need to modify the dataset.

a.     Create an ID column for the column group in your dataset.

For example,there isa datasetwith the following query:

SELECT * FROM Table

The column group is grouped on the field “Group1”.Then, modify the query like this:

SELECT *, Dense_Rank()OVER(order by Group1) AS ID FROM Table 

b.     Create a list in your report, set the detail group of the list with the Expression like this:

=Ceiling(Fields!ID.Value/5)

Note: This meansthat the Max number of column in matrix will be five after you followthe step C.

c.      Sort the dataset bythe column group and then drag the matrix into the list. Click Preview.


Viewing all articles
Browse latest Browse all 28687

Trending Articles



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