Friday, February 24, 2012

Can I specify SubReport name at runtime?

I want to combine a bunch of reports (which are stand alone reports on there own) as subreports in a parent or master report. We have done this in Crystal Reprots in order to get a group of reports out in one file.

The issue with Reporting Services is the header and footers of the subreports are not rendered, so I have to repeat the logo information for each subreport in the body of the parent report. I can do this in a table or list or rectangle, but I have to do this for each subreport. Is there any way that I can specify the name of the subreport at runtime? That way I can put everything into a List and drive it from the database. I noticed that the dropdown to select the report name does not allow you to create an expression for this field.

Hi Chaps

I am also attempting to change a SubReport at runtime.
Could you advise if this is possible ? and possibly some sample code.

Regards

JohnJames|||

hey,

I haven't looked at this for a while...... I built a small report to refresh my memory.
I do not think you can do this - you are basically trying to change the report definition at runtime and you can't because it tries to run the report while you are changing it - kind of a chicken-and-the-egg thing.

In my sample I used a server side report - you may be able to do this if it were a local report where you can get the definition (rdl), change the report name in your code, then run the report. This won't help if you are trying to change the report based on data or flags you pass in.

If you are trying to set the subreport name from a database or parameters, you could put all subreports in and hide/show them based on the input parameters/data. This may cause side affects as you can't disable them so all subreports may run anyways (it's been a while - not sure if they run if they are hidden?) and they will still consume some space in the main report unless you put them in a table row or another control that you can hide or show as well....

sorry I couldn't have helped

ESTUMP

|||Thanks for your reply ESTUMP
As you suggest I found that hiding/displaying subreports is a possible solution.
Although rather clunky.

JohnJames

No comments:

Post a Comment