Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 12 Jun 2009 at 9:40am
I am pretty sure it will executeone per time any sub report is created within the main report that uses it. So if you have a sub-report that is in a group header that uses 1 query and that header si repeated 10 times in the main report it will run that query 10 times. If you place another subreport in the details section of the main report and this subreport uses the same query and there are 100 detail rows in your main report the query will now be run 110 times.
Sub reports can really bog the performance down. When possible it is more efficient to use stored procedures or views to massage data in a way that you can display it in a report with out having to use sub-reports.
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 12 Jun 2009 at 10:16am
Basically every time that subreport is called by the main report it is going to execute any/all queries that are in that sub report. If you place the sub report in a header it is most likely to going to be run fewer times (e.g. 1 time for a report header) and therefore have less impact on the overall performance.
Often a sub report is used to deal with crystal table join problems that are causing duplicate records to appear or a select statement inside crystal is making the data scope to small or forcing an outer join to be an inner join. There is just not as much flexibility in crystal to handle different ways to join or manipulate all the raw data. Sometimes using a stored proc or a view in SQL as the data source instead of the original tables can allow you to pare it down to what you need without resorting to a sub-report.
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