Print Page | Close Window

Load subreport dynamically

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1637
Printed Date: 03 May 2025 at 2:15pm


Topic: Load subreport dynamically
Posted By: rocky20
Subject: Load subreport dynamically
Date Posted: 07 Nov 2007 at 2:56am
Hi is there any way that i can load subreport in runtime.
I have one main report on which i would like to load different subreport.
this subreport can choose end user throug parameter or something else
If i can programatically set subreport filepath, or filename or somehow else dynamically set which subreport will be shown, that would be great.
thanks for help



Replies:
Posted By: jkwrpc
Date Posted: 07 Nov 2007 at 1:19pm

I am not certain you can call a subreport that is not part of the main report. My understanding is that the main report acts as a container for the subreports.  I am not aware you have the abililty to set a subreport path in code.  

As a fall back, what you might do is create subreports and then suppress them until needed. If you have a large report and need a lot of subreports the performance could be impacted.
 
You might also look at the dynamic subreport features, where the subreport does not run/show until its link is clicked. I dont know if this opens up a way to dynamically change the reports.
 
Sorry I can not be of more help.  Perhaps others will have better solutions.
 
Regards,
 
John W.
http://www.CustomReportsWriters.net - www.CustomReportsWriters.net


Posted By: BrianBischof
Date Posted: 07 Nov 2007 at 1:42pm
I haven't done this before, but if you have CR R2 Developer, then you can add subreports dynamically with the report document object object. This is part of the new licensing that comes with R2 Dev. I suggest downloading the 30 day trial version and testing that out before making a purchases.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window