Solved

Crystal reports loop question

Posted on 2011-02-17
3
451 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

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 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

617 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