水晶报表 - 如果包含图表,则数据重复
我们使用 Crystal Reports XI R3 来实现报告目的。我们创建了类型化数据集作为报告的数据源。
我面临的问题包括其中一份报告上的条形图和网格。默认情况下,图表嵌入到标题部分,网格是从详细信息部分生成的。
如果我设计没有图表的报告,一切都很好。如果我提供 8 行数据,它也会在报告中发布 8 行。但是,如果我在同一个报告中包含图表,详细信息部分中的数据就会成倍增加,并且我会得到 64 行或具有相同数据源的数据。
这应该是一个非常简单的功能,但它似乎对我不起作用。我尝试包含一个子报告并在子报告中包含详细信息部分,它工作正常。但是,我也不能采用这种方法,因为该报告本身将作为子报告包含在另一个报告中,并且我们不能在 Crystal 中嵌套子报告。
请帮助我指出可能出现什么问题?
编辑:经过进一步调查,使用两个不同的表格来填充图表和网格似乎存在问题。如果我对两者都使用一个表,则效果很好。
应@Kalyan 的请求附上屏幕截图:
We are using Crystal Reports XI R3 for our reporting purposes. We have created typed dataset which act as the datasource for the reports.
I am facing an issue including a bar chart along with the grid on one of the reports. The chart gets embedded into the header section by default and the grid is generated out of the details section.
If I design the report without the chart, it all works fine. If I supply 8 rows of data, it publishes 8 rows in the report too. But if I include a chart on the same report, the data in the details section gets multiplied, and I get 64 rows or something with the same datasource.
This should be a pretty straight forward functionality, but it doesn't seem to be working for me. I tried include a sub-report and have the details section in the sub-report and it works fine. But, I can't go with this approach either as this report in itself would be included to another as a sub-report and we cant have nested sub-reports in Crystal.
Please help me with some pointers on what could be going wrong ?
Edit: On further investigation, it looks like a problem with having two different tables to populate the chart and the grid. If I use a single table for both, it works fine.
Attaching screenshot on @Kalyan's request:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题确实是在单个报告中使用多个不相关的表。默认情况下,Crystal Reports 不允许使用多个表,除非它们以某种方式链接。如果您不指定链接,它会尝试自行应用链接并在发布报表时运行联接。
由于这种加入,数据对我来说不断重复。
为了解决这个问题,我在网格对应的表的主键上创建了一个组,并使用该组生成网格并抑制了详细信息部分。问题解决了。
The issue indeed was with using multiple unrelated tables for a single report. Crystal Reports by default doesn't allow using multiple tables, unless they are linked in someway. If you dont specify a link, it tries to apply a link on its own and runs a join while publishing the report.
Due to this join, the data was getting repeated for me.
To resolve the issue, I created a group on the primary key of the table corresponding to the grid, and used the group to generate the grid and suppressed the details section. Problem resolved.