views:

111

answers:

1

I have a crystal report that gets its data from one stored procedure, this works fine and I have a nice grouped report with this data, showing information about a particular report,

However, this report also needs to have a number of graphs in the footer. These graphs draw their data from a different table, and so a different stored procedure. If I add this stored procedure to my existing report, I have to link it to the main stored procedure, this data can be linked, as there is a relationship - its about the same account, but the relationship is not really relevant to the report. When I do this I then end up with lots of duplicated data in the main report, the data in the graph is also wrong.

Can anyone explain the way Crystal reports works when there are more than one SQL queries used, and what the best way to accomplish what I need - a report showing both the main data set, and some graphs, which are about the same account, but use different data sets.

+3  A: 

You need to use subreports for your charts - each individual chart will need to be in a separate subreport linked to its own query/stored procedure.

Crystal displays its data based on a single query. By joining the result sets from your stored procedures, you are creating, in effect, a new query. The result of this new query is the reason that your data is duplicating (due to your join).

Each subreport is allowed to have its own query that can be linked to the main report with any number of parameters. It is the only way to have multiple independent queries appear on a Crystal Report.

Graham
Ok, great thanks for that. If I am able to combine all the data for the actual graph part into one query, can I put all my graphs on one subreport?
Sam Cogan
Yes, you should be able to.
Graham