views:

1487

answers:

1

I have a report that I need to run multiple times, with different data input each time. Each report has a page header that uniquely identifies it, the actual body of data, and then a footer that contains the page count in a [x of y pages] format. Obviously I could run each report separately, but I need the page numbers to be across all reports. So that if I'm running it two times, and the first time it has 3 pages, and the second time it has two pages, the footer shows [x of 5 pages] at the bottom of each report.

I tried creating a master report and just embedding the report, but it doesn't show the page header then, I've also considered running them separately, and passing in a parameter to adjust the page number, but I would obviously need to render each report, find out the page total, then re-render each report to have the correct page total at the footer.

Any suggestions? Anything I'm obviously missing?

A: 

In case anyone ends up running into a similar situation, here was my solution:

First to explain my datasets:

public Foo
{
  string a;
  List<Bar> subInfo;
}

public Bar
{
  string b;
  string c;
}

List<Foo> allFoos;

Basically instead of having the allFoos object that I passed to a master report, and then trying to pass the corresponding Bar object to the subReport, I created a new object:

Public FooBar
{
  string a;
  string b;
  string c;
}

List<FooBar> allFooBars;

So basically I flattened the data. From there I created a single report. I added one table that had "FooBar" as it's DataSet, and passed in the collection of "allFooBars." I also created a footer on the report, so that I would have consistent paging across all pages. I then used grouping to keep "Foo" objects together. On the groups I set the "Page Break at start" and "Include Group Header" and "Repeat Group Header" options to true. Then I just set up the Group Headers to fake being my Page Headers along with group headers (basically just 5 lines of Group Headers, one of which was blank to provide some space).

And that was basically it.

Dugan