Solved

Crystal reports loop question

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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 …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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