Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime Grouping 1

Status
Not open for further replies.

mrichey

MIS
Nov 22, 2002
71
US
I found a formula for subdividing a time field beyond what crystal gives you (day, week, hour, minute). Those formulas allow for 30 minute or 15 minute groupings off a time field.

Is there a way to break out a 7-day period into groups of 8 hours. I can't use specified order because I need this to run on a schedule in Enterprise and if I specify certain dates they will no longer be valid for future report runs.

Thanks for any help!
 
If I understand you correctly - you will regularly run a report, that will reflect a rolling 7 day time period, but you want the report to be broken up in 8 hour groups. Assuming you have some form of start date (parameter, or minimum date value for the 7 day range) then simply create a formula to create the many 8 hour 'buckets' and then group on that formula e.g.

if {table.date} in {?Start_Date} to DateAdd ("h",8 ,{?Start_date})
then
"1st 8 hours"
else
if {table.date} in DateAdd ("h",8 ,{?Start_Date}) to DateAdd ("h",16,{?Start_Date})
then
"2nd 8 hours"

and so on for all 21 8 hour buckets (7 days, x 3 8 hour periods each day).


Peter Shirley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top