Reputation: 2865
SQL Server Reporting Services 2008
I have a row with 30 fields. Instead of one row with 30 fields, I want to arrange them so I have three rows of 10 fields each. I created this report using the wizard and the report type is a table (not matrix). How do I do this?
Here is the desired output:
Header1 Header2 Header3
Data1 Data2 Data3
Header4 Header5 Header6
Data4 Data5 Data6
Header7 Header8 Header9
Data7 Data8 Data9
Upvotes: 0
Views: 1593
Reputation: 778
Old question I know, but just in case anyone else is looking, this thread worked well for me: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/32f28407-e1ca-457e-92fd-d292e32dde4e/limit-no-of-columns-in-ssrs-matrix-report
I've copied some of it below, in case the link dies:
Step one: 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
Step two: Add a list to your report
Right-click the list ,and then select Properties.
Click Edit details group… button
Type in the expression =Ceiling(Code.MyFunc(Fields!Productname.Value)/2)
Note:
1) Fields!Productname.Value
is your column group datafield
2) 2
is the number of the columns you want to display in a row
Upvotes: 0
Reputation: 116498
Use three details rows (and three header rows if you are using headers). This means adding two more details (innermost) rows, and two more header (outermost) rows. It should look like the following when you're done:
HEADER: Header1 | Header2 | Header3 | ... HEADER: Header11| Header12| Header13| ... HEADER: Header21| Header22| Header23| ... GROUP HEADER: Group Name DETAILS: Field1 | Field2 | Field3 | ... DETAILS: Field11 | Field12 | Field13 | ... DETAILS: Field21 | Field22 | Field23 | ...
Upvotes: 1