如何在Reporting Services上的文本框中引用组数据?

时间:2021-08-08 08:22:53

I'm creating a report with a table that is grouped by a department code. There's a page break at the end, so each page only has data for that department code. Outside of the table, I want to have a textbox that contains the department code for that page/group.

我正在创建一个包含按部门代码分组的表的报告。最后有一个分页符,因此每个页面只包含该部门代码的数据。在表格之外,我想要一个包含该页面/组的部门代码的文本框。

I've tried using a hidden column with the data, but the textbox only ends up showing the last page's department code on every single page. I imagine I'm missing a simple solution, but I can't figure it out and Google seems to be failing me.

我尝试使用带有数据的隐藏列,但文本框最终只显示每个页面上的最后一页的部门代码。我想我错过了一个简单的解决方案,但我无法理解,Google似乎让我失望了。

2 个解决方案

#1


the problem is that you are just setting the report to break at certain points in the data instead of, say, rendering a sub-report multiple times by passing a parameter to it. the data only exists inside the scope of the table.

问题在于,您只是将报表设置为在数据中的某些点处中断,而不是通过向其传递参数来多次呈现子报表。数据仅存在于表的范围内。

what you could do is set up a sub report that accepts a department parameter and generates data for one department. in the sub report you could then add the header by referencing the parameter that's being passed. then in your main report you create a table with a dataset of unique departments. group by the department in the table, and drag the sub report into the table and set the parameter. if you do it right you should get the same effect, but with the department header.

您可以做的是设置一个子报表,接受一个部门参数并为一个部门生成数据。然后,您可以在子报表中通过引用正在传递的参数来添加标头。然后在主报表中创建一个包含唯一部门数据集的表。按表中的部门分组,并将子报表拖到表中并设置参数。如果你做得对,你应该得到相同的效果,但使用部门标题。

if you need more clarification, feel free to ask.

如果您需要更多说明,请随时提出。

#2


Could you maybe add a column to the table that just looks like its outside of the rest of the table to the user, but is actually in the table. Maybe pad a couple of blank cols then show the data.

你是否可以向表中添加一个列,它看起来就像它在表的其余部分之外的用户,但实际上是在表中。也许填上几个空白列然后显示数据。

If you are handling the page break in the logic of the table you will probably have to keep the data in the table.

如果您在表的逻辑中处理分页符,则可能必须将数据保存在表中。

#1


the problem is that you are just setting the report to break at certain points in the data instead of, say, rendering a sub-report multiple times by passing a parameter to it. the data only exists inside the scope of the table.

问题在于,您只是将报表设置为在数据中的某些点处中断,而不是通过向其传递参数来多次呈现子报表。数据仅存在于表的范围内。

what you could do is set up a sub report that accepts a department parameter and generates data for one department. in the sub report you could then add the header by referencing the parameter that's being passed. then in your main report you create a table with a dataset of unique departments. group by the department in the table, and drag the sub report into the table and set the parameter. if you do it right you should get the same effect, but with the department header.

您可以做的是设置一个子报表,接受一个部门参数并为一个部门生成数据。然后,您可以在子报表中通过引用正在传递的参数来添加标头。然后在主报表中创建一个包含唯一部门数据集的表。按表中的部门分组,并将子报表拖到表中并设置参数。如果你做得对,你应该得到相同的效果,但使用部门标题。

if you need more clarification, feel free to ask.

如果您需要更多说明,请随时提出。

#2


Could you maybe add a column to the table that just looks like its outside of the rest of the table to the user, but is actually in the table. Maybe pad a couple of blank cols then show the data.

你是否可以向表中添加一个列,它看起来就像它在表的其余部分之外的用户,但实际上是在表中。也许填上几个空白列然后显示数据。

If you are handling the page break in the logic of the table you will probably have to keep the data in the table.

如果您在表的逻辑中处理分页符,则可能必须将数据保存在表中。