Discussion Locked

Crystal Reports 8 and SQL Stored Procs

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am creating Reports with CRYSTAL REPORTS 8, using Stored Procs from SQL7. I pass Parameters to the SP and do a single READ from the Database. The idea is then to do various Selects from the Temp Table using different criteria and returning multiple Recordsets to the Report. Is CR8 able to handle multiple Recordsets from a single SP yet? This was already reported to them in CR6 and supposed to be enhanced in later versions.

Regards
Len

5 replies

by limbo

Len,

As you probably know Crystal Reports 7 couldn't handle multiple result sets very well.

If you choose to bind more than one DB Object to a report, unless the database was normalised, or the foreign key relationships are setup correctly, you often ended up with a Cartesian Product.

We worked around this by using SQL7 directly, to shape the resultsets into a manageable fashion.

Consider turning your result set into a view. If the columns are of the same order then a simple UNION statement will suffice.

On the other hand, if the result sets are not the same then consider using a JOIN.

Essentially, what you are doing is creating a 2D array already sorted, ordered and joined before it passes to the report. Use the power of SQL for the purpose it was intended.

I know what you may end up with is 3 or 4 DB objects but remember these two key things:

1. In SQL, you can build a view on top of a view that is queried by a parameterised procedure which creates a table which it populates it using a cursor (flexibility).

2. SQL7 will buffer data pages, optimise and control DB objects, giving you faster retrieval and computation than any client apps (efficiency).

Structure your objects well in the DB forless headaches in the upper tiers. Hope this gives you some ideas.

by limbo

Alas rejected,

Q: "Is CR8 able to handle multiple Recordsets from a single SP yet?" - len@tial.co.za

A: No

Solution - My answer above.

by lenv

So the solution here is the long road of creating various SP's - one for each section / subreport. Its a pity, but the client will have to be happy that this will take a while to run...
Thanks guys for helping

This discussion is closed to new replies.