Pulling parameters from numerous datasets into a subreport
Have created a report in which there is a subreport which has identical parameters. However, these parameters all come from different datasets as there is 10 in each report. How do I enter the values in the subreport parameters? If I type in the usual parameter value e.g. =Fields!Column.Value then I get an error message saying i need to specify which dataset the parameter value is in. What code do I need to enter? Cheers, AndySugs
July 12th, 2011 6:48pm

I'm not 100% sure I follow, but I think you're asking about how to pass values from the main report to set the parameters of a sub report.If that is the case, and you're using BIDS, then try this: Right click on the subreport and select Subreport Properties, then click on Parameters. Click Add and select a parameter from the drop-down list under Name (there should be a list of all the parameters in the subreport, but I sometimes find it doesn't populate properly, in which case just type in the name of a parameter). In the box under the Value column, either select a value from the available list (of fields related to the area of the main report) or click the function (fx) button and enter a formula expression. Click OK. If you're not using BIDS, you'll need to access the settings in a slightly different way, which I'll leave you to figure out! If you get a problem, check you've typed the name of the parameter correctly, it is case sensitive. I hope this helps RayIf this post, or another, answers your question, please click the 'Mark as answer' button so others with the same problem can find a solution more easily.
Free Windows Admin Tool Kit Click here and download it now
July 12th, 2011 7:15pm

Hi Ray, Thanks for your reply. You are correct that i want to set parameters of a subreport but the value of each of the different parameters comes from a different dataset - there are 10. If I enter the value for the parameter as normal i.e. =Fields!Column.Value then run the report I get an error saying I need to specify in the parameter values which dataset they are coming from. Hope this makes sense Cheers, AndySugs
July 12th, 2011 7:43pm

I'm a little confused as to which parameters are causing the problem; the parameters in the main report or the ones in the subreport. Could you post the actual error message you get? ThanksIf this post, or another, answers your question, please click the 'Mark as answer' button so others with the same problem can find a solution more easily.
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 10:57am

I'm trying to set the parameters for the subreport which are pulled from the ones entered in the main report. In the main report there 10 parameters (identical to the ones in the subreport) and the values for these come from a number of different datasets e.g. @Office - comes from GetOfficeList dataset @MatterUno - comes from GetCaseNames dataset @Long - comes from the GetCaseDetail dataset @Short - comes from the GetCaseDetail dataset When I click to look at the values available for the parameters in the subreport they are shown as thus: =First(Fields!long_matt_name.Value, "GetCaseNames") which is obviously incorrect but I've been unable to work out a way to amend it without getting an error. The error I am getting initially when i add the parameter values as e.g. '=Fields!matter_uno.Value' is: Error 3 [rsFieldReferenceAmbiguous] The SubreportParameter(MatterUno).Value expression for the subreport ‘Subreport1’ refers directly to the field ‘matter_uno’ without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. I get this error for each of the parameters in the subreport Cheers, AndySugs
July 13th, 2011 12:58pm

In the main report, the parameter has a list of possible values (usually, it sounds like this is how you've set it up anyway), and a specific value that you set at runtime. In the subreport, you don't need to set the list of possible values. What this means in practice is that you don't need to set any available values or default values in the subreport (you can if you wish, but as you've discovered, you'd also need to add appropriate datasets as well). What I think you need to be doing is setting the Value (as in step 3 above) for MatterUno as =Parameter!MatterUno.Value i.e. set the value of the @MatterUno parameter in the subreport to have the same value as @MatterUno from the main report. If you then set @MatterUno = "Fish" in the main report, @MatterUno in the sub report will also take the value "Fish". Do this for all the parameters you're passing and it should work. Fingers crossed! RayI work to UK time. If this post, or another, answers your question, please click the 'Mark as answer' button so others with the same problem can find a solution more easily.
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 1:28pm

Hi Ray, Thanks for your help. I'd actually tried this as thought it was logical step to take but when ran report the last page (which should have been subreport) showed the very helpful error message: Error: Subreport could not be shown In the errorlist below there was just one warning: Warning 1 [rsErrorExecutingSubreport] An error occurred while executing the subreport 'Subreport1' (Instance: 253iS0): Object reference not set to an instance of an object. Cheers, AndySugs
July 13th, 2011 1:49pm

Have cracked it! In the main report there is a logon parameter which determines which offices a user will see in the office parameter list. This parameter wasn't one where a value needed to be entered by the user at runtime and I presumed that this form of Role Based Security (Offices that appeared in lookup depending on which user was running it) would only need to be entered for the main report and deleted it from the list of parameters in the subreport. I left all the remaining parameters as:=Parameter!Column.Value as you suggested and report seems to have worked OK. Thanks V.much for your help Ray - was much appreciated.Cheers, AndySugs
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 1:57pm

I spent all of last Friday afternoon trying to work out why I was getting that unhelpful error message. By any chance, does the subreport span two pages and is it in a rectangle with the KeepTogether property set to True? If that is the case, change the KeepTogether property to False. If that's not the case then I'm afraid this is one of the more unhelpful error messages. Somewhere in the subreport something is probably referring to something undefined (e.g. a field or object that has since been removed from the report). First thing to try is running the subreport on it's own, to see if that works. Your best bet then is probably to keep removing elements and running the subreort until it does run successfully. This should help narrow down where undefined reference is. Hopefully by then the real problem will be more obvious.I work to UK time. If this post, or another, answers your question, please click the 'Mark as answer' button so others with the same problem can find a solution more easily.
July 13th, 2011 2:04pm

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

Other recent topics Other recent topics