Print Page | Close Window

Run subreports for given date range

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8518
Printed Date: 06 May 2024 at 5:01pm


Topic: Run subreports for given date range
Posted By: nluoma
Subject: Run subreports for given date range
Date Posted: 01 Dec 2009 at 8:26am

I'm trying to create a time log report. The user enters the desired period for the report, and then I need to pull information from four separate subtables. I can do this by printing subreports, one for each table. This shows the data like this:

Work Orders   <--subreport 1
   day 1
   day 2
   day 3
Changes          <--subreport 2
  day 1
  day 2
  day 3
 
The user wants the data sorted by date
 
Day 1
  changes
  work orders
Day 2
   changes
   work orders
 
I set this up so that the main report runs off of the changes, and includes a subreport for work orders in the details field:
 
Day 1                 <--date of change entry
  changes           <--main report
  work orders     <--from subreport in details
Day 2
   changes
   work orders
Day 3
   changes
   work orders
 
The problem is that this only works if there is a record in the changes table for all dates between the selected start date and end date. If there is no entry for Day 2, it doesn't show that date and you don't see the hours logged for any of the subreports either.
 
So, if the user has time logged for work orders on Day 2, but there are no changes for Day 2,  you see this:
 
Day 1                 <--date of change entry
  changes           <--main report
  work orders     <--from subreport in details
Day 3
   changes
   work orders
 
Due to some limitations of the interface I'm delivering the reports through, I cannot use an SQL statement to pull the data into Crystal Reports, and I'm stumped on how to proceed.
 
Does anyone have an idea on how I can create this report so that it will show all days in the selected range?



Print Page | Close Window