Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get group headers to span a Tablix column

I am using Microsoft Reporting Services (rdlc, that comes with Visual Studio 2010)

Suppose I want to create a report that has a Group Header, detail rows, and a group footer. (I'm using Tablix, but if there is a different way, I'm open to it).

Now, there are several columns, but I want for the group header to span the columns. Is that possible?

Another question: Suppose I want to conditionally span columns in my detail row, is that possible? (and how?)

like image 340
JMarsch Avatar asked Apr 22 '10 16:04

JMarsch


2 Answers

Say you have teams/reps and you want to send them their leads/appointments to work on for the day.

A lot of tutorials for grouping in a RDLC Tablix look like this:

enter image description here

But you want it to look like this:

enter image description here

Step by step, here’s how I’ve figured out

  1. Add your table (Tablix) and ensure the DataSetName property is set

enter image description here

  1. Highlight the details row and right click. Add a parent group to the row

enter image description here

  1. Set the group by to e.g. TeamDescription, and check Add group header

    enter image description here

  2. The Row Groups panel should look like this. The indent for the Details is needed.

enter image description here

  1. OK, at this point you’ve got what you don’t really want. ANDY and BELINDA are going to appear in a column to the left of your info.

enter image description here

  1. But that’s fixable. In the spare cell above e.g. ApptStart enter e.g. [TeamDescription] and right click on it and choose to merge the cell across the other three columns. Set its alignment to center. Maybe bold too.

  2. Then delete the first column as that’s now redundant.

  3. Here’s how it should look by now:

enter image description here

like image 136
hawbsl Avatar answered Sep 30 '22 15:09

hawbsl


You can get a field to span columns by selecting a few of the header fields and selecting the "Merge Cells" option.

As for conditionally spanning, you can't do that directly but I can think of a workaround. It really depends on the data you have so for a better answer you need to provide more information.

You could have two detail rows and conditionally hide one or the other. In one row the cells could be merged and not in the other. The only thing you couldn't necessarily control with this technique is the order of the rows, but it might work.

like image 42
Davos Avatar answered Sep 30 '22 16:09

Davos