Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 662
  • Last Modified:

Show only 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...
1 Solution
Nico BontenbalCommented:
So I suppose you have parameters on the main form that control the visibility of the subreports. Suppose the parameter on the main report that controls the visibility of the sub report (sub1) is called Sub1Visible. Create a parameter on the sub1 report (so in the design of that sub report) that is called IsVisible. On the main report in the Subreport Properties on the Parameters section link the Sub1Visible parameter of the main report to the IsVisible parameter of the subreport (are you still with me :-) ).
Now the subreport 'knows' if it is visible or not. You could use the IsVisible parameter in the dataset of the the subreport to prevent it from running a large query like this:
if @IsVisible = 1
  select orderid, orderdate from orders where.....
  select null as orderid, null as orderdate --dummy result set

Open in new window

I haven't tested this but I think it is worth a try.
RNGAdminAuthor Commented:
The solution is definitely worth a try and it worked fine but taking the fact that we dont have a straight forward solution i would certainly recommend this as a solution. Hope Microsoft make this an option in their next release..

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now