ReportViewer:分组/重复表?
我不太确定该怎么做。我访问了资源:http://www.gotreportviewer.com/,但我找不到确切的答案。我正在使用 VS 2010 .NET Framework 4,因此我假设我也在使用 ReportViewer2008。哦,我正在使用 RDLC 文件。
他们展示了一个表格示例,其中数据被分组/排序,并且有组页眉和组页脚,这似乎是我想要的(我认为),但我不知道如何将这些行添加到我的表中。
基本上我有一个对象(注册),其中包含:
- 组名 名字
- 姓氏
- 我
传入一个 ObservableCollection 作为对象数据源。我想要做的是:
[GroupName]
[First Name] [LastName]
Total: ##
...
Grand Total: ##
基本上,排序依据:GroupName,然后 FirstName,然后 LastName。我认为我需要对数据进行分组/排序的方式是不言自明的。我有排序协议,但无法过滤/重复数据。而且,我不知道如何获得总计/总计。我确信我能算出总计,但是总计……我不知道。
I'm not quite sure how to do this. I went to the resource: http://www.gotreportviewer.com/, but I couldn't find the exact answer. I'm using VS 2010 .NET Framework 4, so I assume I'm also using ReportViewer2008. Oh, and I am using RDLC files.
They showed a table example where the data was grouped/sorted and they had Group Header and Group Footer's, which seems to be what I want (I think), but I can't figure out how to add those rows to my table.
Basically I have an Object (Registration) which contains:
- Group Name
- First Name
- Last Name
I pass in an ObservableCollection as the Object DataSource. What I want to do is this:
[GroupName]
[First Name] [LastName]
Total: ##
...
Grand Total: ##
Basically, sort by: GroupName, then FirstName, then LastName. I think the way I need my data grouped/sorted is self-explanatory. I have the sorting down pact, but I can't filter/repeat the data. And, I'm not sure how to get Total / Grand Total. I'm sure I could figure out Grand Total, but Total... I have no idea.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在总计方面遇到了麻烦。我正在使用 VS2010,最后我找到了如何将总计添加到我的报告中。我只有一个组,因此我选择了屏幕底部“Group1”旁边的小向下箭头,其中显示“Row Groups”。然后选择“添加总计”,然后选择“之后”。这会在底部添加一行,其中包含如下表达式:Sum(field)。我将其更改为 Count(field),这就是我所需要的,field 是总计所需的字段。
I was having trouble with the Grand Total. I'm using VS2010 and finally I found out how to add a Grand Total to my report. I only have one group so I selected the little down arrow next to 'Group1' at the bottom of the screen, where it says 'Row Groups'. Then selected 'Add Total' and then selected 'After'. This added a row to the bottom with an expression like: Sum(field). I changed this to Count(field), which is what I needed, field being the field needed for the Grand Total.