Can I pass a paramter to the Subreport ReportName field using SSRS 2008 R2?
Hello, I have a main report that would contain dozens of subreports, all of them with the same parameters and size. I will have a Report Name parameter that will specify what report should be displayed. How can I pass the Subreport name as a variable depending on the choice? This would allow to only do it once in the main report instead of being so repetitive not easy to maintain if/when something changes. Thanks in advance for your help/suggestions. Vanessa
November 9th, 2011 8:01pm

When you call a Sub-Report from a Report, you definitely have an option to pass parameter. Give the Report Name parameter in the textbox where you give the Sub-Report name. It will choose the Sub-Report based on the Report Name.Bunch of thanks ~ Deva ~ mark it as answer if it answered your question :)
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2011 5:32am

Hi Vanessa, As devanathan suggested, there is a provision of passing parameter along with report name inside reports. Can you provide more details on the text when you say, "How can I pass the Subreport name as a variable depending on the choice?" Regards, Manoj *Happy to help http://experiencingmsbi.blogspot.com/
November 10th, 2011 6:16am

Hi, I would like to know how can I pass the Sub Report Name, this way I only need to have one subreport object in the main report. Once the subreports have the same parameters I only need to have the Report Name that will be called. Thanks in advance for your help, Vanessa
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2011 5:46pm

1) Yes you need to have your sub-report name fixed so as to call from main report (without changing any value in main report) 2) to dynamically call a subreport from main report use the expression tab in the subreport item (in main report) whose output will be the required subreport name ** you can use a switch or case statement in the expression to evaluate the subreport name.
November 16th, 2011 6:37am

How can I do that? I don't see where I can have an expression for the report name. I really would like to have the name dynamically set. The Report Name is chosen from a parameter that is from a dataset with all the names of all available reports. I would like to be able to display the report based on the report chosen by the user without having to add dozens of Subreport objects in the main report and have to deal with the hide/display property and still being able to use the same Header and Footer. This way, the subreports on contain the detail part that will be displayed inside the main report. I'm using SSRS 2008 R2 and the report will be displayed in a dashboard not sharepoint. Thanks a lot for your help.
Free Windows Admin Tool Kit Click here and download it now
March 12th, 2012 5:33pm

Have you manged to resolve this. If so can you please let me know.
May 30th, 2012 7:35am

Hi, In the SubReport tool, if you open the property in the sub report name you can choose the paramater name or available field names from your dataset. In the right side if you see, there is an expression button (Fx). Clicking it will take you to the expression dialogue box. There you can write expression for dynamically choosing the sub report. If you still not clear about it, please let me knowBunch of thanks ~ Deva ~ mark it as answer if it answered your question :)
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2012 5:44am

Hi, In the SubReport tool, if you open the property in the sub report name you can choose the paramater name or available field names from your dataset. In the right side if you see, there is an expression button (Fx). Clicking it will take you to the expression dialogue box. There you can write expression for dynamically choosing the sub report. If you still not clear about it, please let me knowBunch of thanks ~ Deva ~ mark it as answer if it answered your question :)
July 6th, 2012 5:45am

I don't believe either of Deva's answers or no_prakash's answer are correct - there is no such expression button for the sub report name in Visual Studio (for SQL 2005, 2008, 2008 R2 or 2012), and the developer reference indicates that a name (and not an expression) is required. http://msdn.microsoft.com/en-au/library/microsoft.reportingservices.ondemandreportrendering.subreport_properties.aspx I'm almost certain you must specify a particular report as the subreport. Thats the way SSRS works. The closest workaround I'm aware of is to make objects in the sub-report conditionally visible (i.e. hide the objects you dont want to see). Good luck! Mike
Free Windows Admin Tool Kit Click here and download it now
September 16th, 2012 9:35pm

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

Other recent topics Other recent topics