Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal reports loop question

Posted on 2011-02-17
3
Medium Priority
?
453 Views
Last Modified: 2012-05-11
I have a report that has a sub report that does some processing.  The parameter to the sub report is a year.  I want to call the sub report for a range of years.  This is provided by the user as a parameter.

So the user may enter a range of 2007 to 2010.  So then i want to call the sub report for the years 2007, 2008, 2009, 2010.  Another time a different range would be entered.

Is this possible?  The main report does not have any "data" and no database connection of its own... i just would like to somehow use the parameter range to call the sub report for each value in the range.

Really its just a for loop... would be great if i could put the sub report in the details section and then execute it for the supplied range.
 
0
Comment
Question by:soozh
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
James0628 earned 2000 total points
ID: 34915045
If you're dealing with a limited number of values, you could create X number of detail sections, put a copy of the subreport in each section, and pass each copy a different value from your range.  You could use a suppression formula for the sections to suppress the subreports that you don't need (because the range doesn't include that many values).

 If you don't want to limit the possible number of values like that, you could set the main report to read something (an Excel file or a simple text file or whatever) and have the subreport executed once for each record, passing it a different value from your range each time.

 James
0
 

Author Comment

by:soozh
ID: 34915184
thanks.. both are good solutions in what CR offers.  

any other solutions?
0
 
LVL 35

Expert Comment

by:James0628
ID: 34924469
Nothing really springs to mind, as far as executing the subreport for each year goes.  You can't execute a subreport in a loop or anything like that.

 However, maybe there are other ways to handle this.

 The subreport could accept a range of years and run for all of those years.  If it groups on the year, you can basically get a separate report for each year (each year starts on a new page, etc.).

 For that matter, if the main report doesn't contain anything but this one subreport, do you really need the subreport at all?  Maybe you could have the main report produce a report for the range of years, grouped on the year, and forget the subreport.

 James
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question