7/24/2015

SSRS Add Group Header Back to Tablix

This week I got the opportunity to write some SSRS code for a client.  The task was to convert 6 Crystal Reports to SSRS SQL Server Reporting Services 2012.

So the SQL was replicated to the new server, added indexes and began building the report.

The Tablix report consisted of 5 Groups and 10 Detail rows.  After creating the 5 Groups, at some point I removed a few of the Group Headers to clean up the report.  Finished, moved to Dev to testing.

Began the second report.  Was very similar to the first.  So I made a copy, renamed, added to the Project, connected the SQL to the report via Data Source.  And realized the need to add back the missing Group Headers.

I scanned the internet, Google and Bing.  Didn't find a workable solution.  So I pulled one the older version of the Project, which I saved to another location for just this purpose, loaded the project and began to compare the old code with the new code.

First thing, I saw the rows had to be added back in the Header.  Looking at the old report, Textbox76 was a field that had been removed.  



Then opened up the Report in Code mode:

Copied the entire "TablixRow" XML Code from old project to new project:


And did the same for the other 2 rows.  Sure enough, the rows re-appeared in the new SSRS report.

Next step, there was a difference in the XML around the Group field:


Here, you can see additional code in the old report, highlighted here:



Actual code here:


                        <TablixMember>
                          <Visibility>
<
Hidden>true</Hidden>
                          </Visibility>
                        </TablixMember>

Then the Tablix report looked like this:


 Then added more code to the other Groups:


Now we have connecting lines indicating the newly added rows belong to the Groups as Header.  The desired outcome:



Group Headers have been re-added back to the SSRS after being deleted.  The trick is to go into the XML code and add the missing TablixRow first, then add the Group XML code.

And there you have it. Hope this helps~!

No comments:

Post a Comment