use expression to dynamically decide which subreport to open - reporting-services

I have a report that contains several pages with graphs, tables and so on.
This report is used by different customers who always want small modifications to the report. At the moment if a customer wants a change on page 5 the whole report is recreated with the modifications, even though the only change is in the graph on page 5.
More so, some customers don't want to see page 3, others want a custom table at page 6.
My boss would like the report to be modular so he can simply switch parts on/off depending on what the customer wants. At the moment a change in a report means development followed by deployment.
My idea is to create a report with a number of subreports. Each graph/table would be a subreport so that if a change is needed we only need to change thàt specific subreport.
Ideally a dataset would be attached to the mainreport detailing which subreport to show: for customer X we would show SubreportX, Customer Y would see subreportY.
I know this can be done by adding all possible subreports to the mainreport and switching visibility per subreport but more elegant would be to dynamically decide which subreport to show. On drillthrough reports this is possible by using an expression to determine which report to open;
eg IIF(customer = X, "subreportX", "SubreportY")
but is this possible with subreports?
To be clear: I am looking for a way to decide dynamically at the moment of opening the report which subreports to show. Something like using an expression to get the name of the wanted subreport.
I have been searching for this (in VS2012 and through Google) but I cannot seem to find a definitive answer whether it is possible to decide at opening the report which subreports to show....
I found the following but again that seems merely to be using toggling visibility:
Dynamic subreport in SSRS 2008
I am very much hoping for suggestions, answers or even general directions. Thanks for thinking with me!

I would create a Dataset that returns the list of valid subreports for the selected Customer. I would add all the possible subreports to the master report. I would set the Visibility property of each sub-report using a Lookup expression, targeting that dataset.

Related

SSRS - Two different reports in one Excel?

I am pretty new to SSRS, so forgive me if I am asking something that is either obviously not possible (or easy) - I haven't found what I am looking for so far!!
I have a Detailed report, which splits by group onto multiple Excel tabs (pages). I also have a separate Summary report which outputs onto one page.
I want to merge these two into one report, so the users receive just one email, with tab 1 showing the Summary report and tab 2 on wards showing all the Detail.
The datasets come from two stored procedures and whilst related, they are different so I can't use the same dataset.
Is this possible in SSRS?
Thanks
Mark
Take your Detailed report and insert a subreport at the start of it. Set the subreport properties to point your Summary report.
If you have any manually set parameters in the Summary report, you'll need to set them up in the Detailed report (if they don't already exist) so you can pass the parameters to the subreport.
Now you have a single report with everything in.

Add a Filter to SSRS

I need to add a filter to a Report, that within anotherreport, the filtered results appear in the drilldown report.
For example: An .rdl file displays the first report, in that report a link can be clicked to access another report (.rdl) file. The report that displays after clicking link should be filtered by option selected from the first report(.rdl).
How could this be done? My thought that two datasets in each report could provide the information for the filter, however the filter expression is not valid this way...? I know this may not be the best way to do this.
So creating a drilldown report would be more acceptable. Creating one report and including a dataset with it by setting parameters to be called in the drilldown.
Does there need to be two datasets for each report to do this? I was assuming that the filter expression be written to do this: Field!.name.value AND Field!.name.value, etc to the whatever value I need to compare to or by.
Could this be a shared dataset to do this?
I was able to solve or partially solve this. I created a new report, with a query with the necessary columns that I needed in report 2. The drillthrough report(report 2) is linked from a textbox from a report allowing a user to view the information they need by clicking a link that displays the new report(passing the parameters from report 2 to the new report). If anyone has trouble with this, the simplest way would be to create one report and pass parameters to report two with parameters created from whatever query you want to use that has the values you want as columns in the report.

reporting services, have two reports in rdl

I have a SSRS 2008 report that shows some information based on a start date.
I would now like to add another instance of the report to the same rdl, with a different start date.
How can I add a second instance of the same report to the rdl file? There doesn't seem to be a way to copy and paste it in.
The dataset is the same, just a parameter value changes, but both need to be shown on the same report.
Your question sounds a little confusing, because you're talking of "a report in an rdl", but an RDL is a report. What you should probably be looking into is creating a subreport. You can create a "master" report that holds the subreport either exactly twice (2 times) or in a list (n times).
The business case around your start date will determine which option is best for you. If you just have a master report with merely two subreports right below eachother, you can hard-code the parameter "start date" for both subreports. In this case you don't even need a data-set in the master report.
If you need or want to be more flexible use the other option with the subreport in a list. You could create a dataset with a column "start date" and bind that to the parameter for the subreport. This way it's easy to extend the setup to show the report three, four, or n times.
In any case, either option allows you to minimize copy/paste action, which is a good thing.

Report structure from table

I have a large project with a lot of reports, but the items in the reports are quite standard, reusable with parameters. So I've made subreports, that's OK. Now I assemble the reports by adding subreports to them by hand, plus setting the parameters, also by hand.
I think that this is not flexible enough, I'd like to have a table that defines the structure of the report: like one row per subreport, specifying the name and its parameter values. Then the report would be assembled together runtime in a list or something like that, by calling and inserting the subreport by name.
Is it possible somehow?
I can't think of a way to dynamically assemble a report like that without coding something that would generate the required RDL, upload it to the report server and then execute the report.
Another option might be to create one master report with all possible subreports in it. You could then use a table to control the visibility of each subreport, to simulate generating different reports. Obviously you don't want to execute long running queries for subreports that are hidden, so you would have to add a parameter to all your subreports so that if the subreport is hidden the dataset returns no data, e.g.
WHERE
(....) OR (#SubReportHidden = 'Hidden' AND 1=0)

Linking SubReports Without LinkChild/LinkMaster

I'm maintaining and occasionally modifying an Access 97 program that's still a crucial department tool for a very large US corporation.
A number of reports use a "totals" subreport that I cannot link using LinkChildFields \ LinkMasterFields. In each case, the main report can be filtered by numerous (or no) criteria via a "Reports Manager" form.
I've coped with this by using a generic function that opens any subreport in design view, and edits the .Filter property. Works 100% OK.
However, this prevents me from distributing the app as an .mde file, as Design view is unavailable in an mde.
I've tried every alternative I can think of:
setting the subform filter during Open event to that of the Parent (error)
using Docmd.ApplyFilter during Open event (does nothing at all in a subform)
Although this 'old' app suits the Department using it perfectly, their IT want to implement a 'big-picture solution', and I really don't want a competitor to have free access to a heck of a lot of complex business rules I've worked so hard on over the years.
Does anyone have any suggestions re the subform filtering, so I can use an mde?
MTIA
Why can't you link to the "totals" subreport using Link Child/Master? It should run off the same record source as the main report and aggregate over the records. In any case, if you can specify a filter criteria, you should be able to specify a domain aggregate criteria (dsum, dcount, dlookup etc) that returns the same values.
Dynamically editing the filter property in design view to make it work is a kludge. There is a reason that it difficult, not because the Access designers wanted to make it hard for you to embed subreports with dynamic criteria, but because it's a bad idea. Don't do it. There is something wrong with your report record source if you can't either join the subreport on record fields, or get rid of the subreport altogether and aggregate within the main report. You probably already know this, but you can aggregate (sum, count, etc) over the detail in a report in the report/page/group header/footer and give totals that way.
For example, if you were writing a report for a printable invoice, you could move everything above the line items into the report header, leave a line item as the report detail, and move everything below the line items into the report footer. Then you could do sum() over the detail fields to generate your subtotal then add tax, shipping etc. Another way to do this would be to use a subreport for the line items then try to calculate the totals externally, not as simple and way more fragile if the subreport changes.
Have you considered rewriting a query on which the subreport is based? The SQL string of a query is easy to change, and you will be able to make an mde using this method.