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!

want to group by 'Time Periods'. Database in HHMMSS 1

Status
Not open for further replies.

ekimr

Technical User
Jun 28, 2002
124
GB
Hi,

My database row reads like a series of timed events.

NameOn, NameOff, DateOn, TimeOn

The date could have say 100 records for 20030901 (ccyymmdd)
Then another 100 or so for the 2nd september etc.

My first group will be by Date.

But i want the second group to be ranges of intervals (e.g) (midnight to 8am, 8 to 11, 11 to 2, 2 to 5, 5 to 8 then 8 to midnight).

This is because I want to do analysis of busy hours, volumes etc.

Ok - The second group 'time ranges' is flexxible if that helps but I should be accumulating to some period time range.

Can anybody please advise.

Thanks
 
Depends on how your time is stored.
But assuming your time is a string something like "235959", then you could write a formula like:

If {time} < &quot;08&quot; then &quot;Midnight to 8am&quot; else
If {time} < &quot;11&quot; then &quot;8am to 11&quot; else ...

And then gorup on the formula.


Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- tek@kenhamady.com
 
Hi

Thanks for the response. Although I am not sure I understand the implementation.

The group header needs to loop around based on 4 or 5 hard coded values.

To take your example:
&quot;midnight to 8am&quot; is the first group, so I would put some select criteria on the detail level to get those records where the time is between 0001 and 0800
&quot;8to11&quot;

But how do I get the group header to loop round these constant values - and then link that hardcoded value to the select criteria at detail level (i think I get the last bit)

Thankx
 
When you add a group on the formula that I have suggested, each record will automatically fall into one group. The group header will then automatically print at the beginning of each group. That is all there is to it.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- tek@kenhamady.com
 
Help!!

I think this should be so easy, but sorry, it just isn't working, and because I can't understand how it can, maybe thats the problem!

I have single line records in my single table.

i want to group on commong time periods (so all the 8am to 11's are grouped together), then all the 12pm to 3pm).

So I create a formula as you have indicated. - Do I 'drag and drop' that field into the group area, or do I modify the group properties?

Also, if I was to call the &quot;8amto11&quot; selection criteria 'fred' I would expect to see 'Fred' displayed in the output? Currently its empty?

But then I know you have suggested an answer to it - but its not working , but I want the detail section to repeat as many times that there are time periods in my table that match that the group criteria is set for i.e only 8 to 11 am. all time and dates come out at detail level.

Sorry for what is seemingly a simple report causing so many questions.

 
Once you write the formula you go to:

Insert - Group

and use this formula field as your second group, after your date group. Whatever you put as your descriptions will appear at the beginning of each group.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- tek@kenhamady.com
 
Yes, at last I seem to have progressed.

Thank you for the clarification, and i even began to doubt my own sanity!!!

I also defined my numeric time matches wrong.

Thanks again.

Mike

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top