Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports 10 Dynamic Report Creation

Status
Not open for further replies.

garyw5

Programmer
Mar 8, 2006
2
US
Hi
Does anyone know how to create a dynamic report in Crystal Reports 10? For example, I have a main shell report that I need to add multiple subreports to at runtime. The subreports will be dynamically created and the number needed will be unknown until the report runs so I cannot manually create the template. I assume this will need to be done in code but does anyone have a sample of how to do this?
Thanks in advance
 
This would require the special Report Creation license if you wish to do this in code.

If you explain the situation in more detail, it may be possible to suggest an alternative approach.

- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
I'm still interested in hearing ideas about this. I am looking to do a similar thing myself using Crystal Reports in Visual Studio .NET 2003.

What I need to do is create a report that contains one or more of say 5 predefined reports, depending on user selection. A user might like to have an overall statistics report, and/or a network traffic report, and/or a timesheet report etc.

So at runtime, the user can select some or all of these reports to be bound together into a single report. The data are not related. The report types are predefined in .rpt files as part of my project, and datasets used to fill each are available at runtime.

What I initially planned was to add them as subreports somehow to make one big report. Either I would do this at design time by adding subreport placeholders into new Detail sections and then populate them (or not) at runtime, or somehow add new subreports in an ad hoc manner as required to a master report.

Is this possible at all? I need the user to be able to view them in the CRViewer and save them as one PDF file which is why I am trying to combine them at runtime. I read on CR's website that they can be viewed as one if you embed other reports as subreports. I hoped to be able to do this at runtime.

Any ideas would be well appreciated.

Thanks
 
Insert the subreports one each into its own section.

Let the users control which sections are not suppressed by selecting report options into a multi-value parameter. The section suppress attribute expression would then check that parameter to see if the section (and hence the subreport in it) should be suppressed or not.

- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Hello Ido

Thanks for the quick reply and the good advice.

That solution looks good. For ultimate flexibility, is it possible to assign an arbitrary report decided at runtime to each of the sections you mentioned? ie. can I pick from say 10 possible .rpt files and assign them as required to 5 precreated subreport sections in the master report, as you have suggested?

I am a beginner with CR; where do you find information about how to code this? I have looked endlessly for examples about dealing with subreports programmatically, and have found none. If the above idea is possible, can you name some relevant functions or properties that I can research? VB.NET or C#.NET are OK.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top