Sunday, March 25, 2012

Can I dynamically add subreports to a report?

Is there any way of adding subreports to a "container" report at runtime?
I need to make the reports composable and would prefer not to have the
superset of all reports in the container and just toggle visibility. Right
now the only solution seems to be to generate my own RDL on-the-fly, which
seems like using a sledge hammer to crack a nut.
Any help would be appreciated.
Thanks
StuOn Apr 26, 10:52 am, Stu <s...@.community.nospam> wrote:
> Is there any way of adding subreports to a "container" report at runtime?
> I need to make the reports composable and would prefer not to have the
> superset of all reports in the container and just toggle visibility. Right
> now the only solution seems to be to generate my own RDL on-the-fly, which
> seems like using a sledge hammer to crack a nut.
> Any help would be appreciated.
> Thanks
> Stu
Aside from creating the RDL files via ASP.NET application (custom as
you mentioned), you could include the normal subreports directly as
tables in the main report and then just toggle the visibility based on
if data is returned as part of the dataset (assuming each table
control will have its own dataset). Something like this might work (as
part of the Visibility expression):
=iif(Sum(Fields!SomeFieldName.Value, "SomeDataSetName") > 0, "true",
"false")
Also, you might want to include several table controls in a rectangle
to conserver space when they are not displayed.
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||Thanks Enrique. I think creating the RDL files via the ASP.NET application
suits my purposes more than the "toggle visibility" approach. This is mainly
because there are many containers and many sub reports and there can be any
combination of them. So if someone adds a new subreport I would have to go
and add it at design time to all the containers. If I create the RDL myself I
can just create the requested combination on-the-fly.

No comments:

Post a Comment