Running SubReports on demand?

  • I all I have created a simple test using 3 reports. The 1st report, (MainReport) houses two subreports. The MainReport has a boolean parameter which turns on and off the visibility of SubReport1 and SubReport2 - so only one report is displayed at any one time.

    When I run the MainReport I notice that both subreports are processed regardless of which one is displayed.

    Ultimately I need to produce a batch of reports which can use one of two differing calculations. All the underlying data, is created ahead of time by a stored proc and are held in a table ready for the reports to pull the data from. The problem is the layouts for the reports are slightly different depending on the calculation used - hence the reason to look into the subreports.

    Has anyone had a similar piece of development they have had to work around? Or does anyone have any ideas for the best way to do this?

  • I'm on the trail dynamic subreports as well and a colleague came across the following snippet of code in a newsgroup somewhere:

    First, I created a subreport and created a Parameter that only had one

    available value, for instance, the parameter TypeID and the available is set

    to one. Then in the main report, I set the subreport to pass the TypeID of

    the recordset to the subreport. If it didn't match the TypeID in the

    subreport it didn't run the report. Then I set the NoRow equal to a space

    and it didn't show anything then. It works perfectly, now if the main

    recordsets TypeID matches the available TypeID of the subreport it runs

    against the sql server, otherwise it doesn't run the subreport. I then over

    laid the 8 subreports and it is working perfectly.

    What I haven't been able to nail down is how this person didn't run the report. I also found a post by somebody else suggesting that you put a parameter inside your stored procedure that will run/not run the data. I don't know if this is helpful to you.

    I'm looking for a way of not running the subreport as I need to stack a number of subreports, not all of which need to run but this is determined at runtime by each employee being reported on, and I don't want to not have the overhead of calling every subreport and it's corresponding stored procedure.

    Linda

  • My application is in Silverlight and the report generation page is .aspx where i have the report viewer which is set to .RDLC in my web application. I have 15 subreports and we show/hide based on parameter but everytime datasources are getting loaded for all the sub reports and causing my report processing to take more time. If have one subreport it takes 6 seconds, for 2 sub reports - 8 secs, 4-9 sec and 16 subreports take 16 seconds which is a very big performance issue. So what is the best way to tackle this issue. should we go for dynamically modifiying the master rdlc file holding all the sub reports or is there any way we can remove them from the subrepor in the page initialization so that only selected sub reports are processed.

    Any inputs on this are greatly appreciated.

    Thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply