Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Efficient use of subreport Post Reply Post New Topic
Author Message
[tupe]
Newbie
Newbie


Joined: 20 Nov 2011
Online Status: Offline
Posts: 1
Quote [tupe] Replybullet Topic: Efficient use of subreport
    Posted: 21 Nov 2011 at 1:04am
Hi,

I've created a Inventory Turnover report with CR XI.
The main report queries information regarding item stock balance in given period. Fields are grouped by the item and placed in the group footer.
The sub report queries the items and sums up the ordered quantity with in last 365 days. This is also grouped by the item on sub report and placed on the group header on the main report. The report are linked with grouped items.

The report works fine but it is really slow because sub report is run for every item one by one.
Is there better way to do this?
Is it possible to accomplish this so that the sub report is run only once?



Best regards,
Tupe
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Nov 2011 at 5:15am
technically, no, the subreport needs to run each and every time, but there are ways around hitting the database.
 
You can use a stored procedure to fetch all the data into one really wide dataset, then you can usually group and return the same results as the subreport without actually hitting the database (or even a subreport).
 
You could have the subreport, but if you report is called from an application, you can have the application get the data and set the datasource of the report, this way, the reports gets the data, but you control the data/hits to the database.
 
If I was writing the report for a stand alone report (no application) I would probably opt for the wide dataset as that has only 1 hit to the database, and you can usually get everything to display without needed to resort to a subreport.
 
HTH
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.