Solved

Crystal reports loop question

Posted on 2011-02-17
3
440 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 34

Accepted Solution

by:
James0628 earned 500 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 34

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now