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:
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.
来源:https://stackoverflow.com/questions/7525651/crystal-reports-data-repeating-if-chart-is-included