use expression to dynamically decide which subreport to open

蹲街弑〆低调 提交于 2019-12-22 08:38:35

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/23492599/use-expression-to-dynamically-decide-which-subreport-to-open

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!