Show selected sub reports
Hi , I have a ssrs RDL report which has 10 sub reports. Every thing works fine when we run the report.I see all 10 reports on the web page. We now have a scenario, where user selects some out of 10 sub reports (selection is through aspx page). Based on the user selection i need to display only the selected reports. I am able to achieve this by hiding the report based on an expression. But i am sure that all 10 reports run irrespective of the selection and display only selected based on user selection. How do i over come this issue. User may select only 1 out of 10 reports to view it or he may select 9 reports out of 10 to view it. How do i achieve this.? Right now i place all 10 sub reports in one rdl file. Each sub report in one rectangle control. and i have an expression which controls the visibility of the rectangle. Please help...
April 19th, 2011 5:22pm

They way a sub-report works is that it becomes a part of the main report even though it is a stand-alone report in itself. Hence, when you run the main report, its sub-reports will also begin to render themselves and we cannot "stop" them from rendering. Hiding the sub-reports not chosen by the user is an option, but the do infact send their queries to the database and hence contribute to the overall execution time of the main report. If your sub-reports show data filtered by either a parameter of the Main report or by navigation (clicking on a EmployeeID in the main report to get his/her details in the subreport), you can link that parameter/field to the dataset of the Subreport so that it submits the query to database only if there is a value set for that parameter. For Example, the query inside the dataset of the subreport may look like: IF (@EmployeeID IS NOT NULL) EXEC <stored procedure or in-line query to fetch the employee details> I am not sure if this is a feasible implementation in your project, but all I am trying to say is that you'll havr to innovate to get this implemented and also not hurt the performance of the Main report even though you "hide" the unwanted sub-reports. Hope this helps! Cheers!! Muqadder.
Free Windows Admin Tool Kit Click here and download it now
April 19th, 2011 6:18pm

Thanks so much Muqadder. This is a very good answer and can be considered as a possible solution. I am dealing with not just 10 reports at a time and i am dealing more than 50 reports in one single click event. The already developed reports may be used else where. So changing the stand along report logic should not affect other places. So i am thinking of more possible/flexible solutions. In crystal reports i guess there is some thing like supress sub reports using expressions. I am not sure how it works in SSRS.. Other solution i thought is to convert each server report into bytes and concatenate each array of bytes and flush out as PDF. But for some reason when trying to concatenate all the array of bytes and flush i am not getting the expected result. I can certainly change my approach if i find any thing which satsifies the above scenario. Client needs to export all the selected reports into one PDF. That is all i need. I am able to achieve but not a recommended solution.
April 19th, 2011 9:51pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics