Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Grouping over Date Range Post Reply Post New Topic
Author Message
jacobtindall
Newbie
Newbie


Joined: 05 Feb 2009
Online Status: Offline
Posts: 3
Quote jacobtindall Replybullet Topic: Grouping over Date Range
    Posted: 20 Feb 2009 at 11:15am

We are a hotel company.  I am trying to write a report that shows the number of adults in house by day.

 

The records I need to use are reservation records in one table (check in, check out, adults etc..).  My question is how to I use crystal to determine the number of adults “in house” using these reservation records.

 

Example:

 

Check In:  02/20/09

Check Out: 02/25/09

Adults:  3

 

If I group by adults I can use check in, or check out.  But using the example above there would be 3 adults ‘in house’ for 2/20, 2/21, 2/22, 2/23 and 2/24.  I can only group by check in or check out.

Any ideas?  I can't wrap my head around the logic.


Thanks! Jacob


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Feb 2009 at 4:46pm
Are you working with a small date range? You could create sub reports for each day if it is not a lot of days that you need to handle.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Feb 2009 at 7:04am
there has to be a way to avoid a subreport, though it is looking as one of the easiest methods.
 
if there are checkin everyday, then you might try something along this idea, which is using shared variables.
Everytime this is checkin, add the people to the total and update a string with their checkout date and the number in the group.  Since every day there is a checkin, you can first check the string to see if that date is there, and if so, subtract the number of people in the group(and update the string).  I would do this by using a delimited string, though that may not be necessary.
 
Since CR XI can loop, you wouldn't need to worry about grouping the checkouts, just a date and number, just remember to rewrite the string when dates are removed, this will keep the string 'shorter'
 
you could even create totals of checkin/checkout for a given day if desired.
If checkins cannot be guarenteed for everyday, I am sure that there is a way to return all the dates in the range and then group the data by calendar date.
 
I realize that this is sketchy, but hopefully it points in a direction that you can use.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.