问题描述
我们使用 Crystal Reports XI R3 进行报告.我们创建了类型化的数据集,作为报告的数据源.
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.
如果我在没有图表的情况下设计报告,则一切正常.如果我提供 8 行数据,它也会在报告中发布 8 行.但是,如果我在同一个报告中包含图表,详细信息部分中的数据会成倍增加,并且我会得到 64 行或具有相同数据源的数据.
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.
这应该是一个非常直接的功能,但它似乎不适合我.我尝试包含一个子报告并在子报告中包含详细信息部分,它工作正常.但是,我也不能采用这种方法,因为该报表本身会作为子报表包含到另一个报表中,而且我们不能在 Crystal 中嵌套子报表.
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 ?
在进一步调查中,使用两个不同的表格来填充图表和网格似乎存在问题.如果我对两者都使用一个表,它可以正常工作.
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.
附上@Kalyan 要求的截图:
Attaching screenshot on @Kalyan's request:
推荐答案
问题确实是针对单个报告使用多个不相关的表.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.
这篇关于Crystal Reports - 如果包含图表,则数据重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!