开发者

passing values into Sub-Reports SSRS

I have a master report that has no parameters. But I have to include a sub-report with the same grouping 开发者_如何学JAVAas the master report. (i.e, the same report has to show data for the same project listed in the master report) I'm using different Datasets for both reports but the tables come from the same database. I've tried including a parameter into the subreport and pass the current projectID into the parameter of the subreport. It doesn't seem to be possible.

Is it possible to pass field values in master report as parameters in subreports?


I'm a bit curious on your "it doesn't seem to be possible" because I'm currently working on master report and subreport as well. The answer for your short question is "YES". it is absolutely possible to pass value from master report to subreport.

So Can you please check them again whether their properties are correct or not? For example.

  1. Your subreport's parameters are created properly?
  2. You can try put your subreport inside detail row of your master report.
  3. When you set properties of subreport, you can set which field of master report you want to be a parameter for subreport. it's quite straightforward.

Hope this help.

PS. sorry for my poor english.


Absolutely yes. Put a dataset in your main report that will go through your projects as you want it. Then put a LIST, that's the key point. The list should refer to this dataset. Now put your dataset inside the list's container area and set it's parameter to the project ID of your main report's dataset. Easy.


This is just clarification of what the previous people said:

NOTE: In this example T9_PK is the primary key for Table 9 (i.e. the employee table)

The purpose here is to create a subreport that is the 'Time Card' for each employee, and then create a Main report that has all the employee Time Cards, each on a new page.

  1. Create a report that uses a parameter (e.g. Parm: T9_PK) {This will be the Sub-report e.g. TimeCard.rdl}
  2. Drag drop 'List' control onto design surface of a new report {This will be the Main Report}
  3. Add a dataset to the Main Report that has a field that will end up being the Parameter of the 'Sub-report.
  4. Drag the field (e.g. T9_PK) from a dataset {previously added to report}into the List 'Control.

  5. Drag drop a Subreport control into the Cell of the List Control, on the Main Report (e.g. AllTimeCards.rdl).

Set the subreport to the previously created report (e.g. TimeCard.rdl, with a single Parm: T9_FK)

Set the Subreport properties => Parameters:

Name: T9_PK

Value: [T9_PK]

NOTE: the Parameter for this sub-report is the one that is coming from the dataset for the Main report

  1. Right click on '(Details)' in the 'Row Groups' Pane (below Design Surface) => New Group => T9_PK
  2. As an additional option set the page breaks: Right click on '(T9_PK)' in the 'Row Groups' Pane (below Design Surface) => Group Properties {window} => Page Breaks {left pane} => Page Break Options: [x] Between each instance of a group
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜