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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting by Date and Time fields 1

Status
Not open for further replies.

AP186

Technical User
Apr 13, 2004
12
GB
The working day here is 05:00 to 05:00 How do I select daily data based on this format. 05:00 hrs Monday to to 12:00 hrs Saturday?
 
Do you mean 5AM to 5PM? Then use:

If dayofweek({table.date}) in 2 to 6 then
{table.time} in time(5,0,0) to time(17,0,0) else
if dayofweek({table.date}) = 7 then
{table.time} in time(5,0,0) to time(12,0,0)

This assumes you meant that Saturday hours are 5AM to 12 noon. Not sure what sorting has to do with this.

-LB
 
Try posting meaningful information.

LB is very intuitive, but your post has very little to go on. The guess was that you wanted until 5 PM (though you didn't bother to state your start time presumably because you're soooo busy figuring this out) for weekdays, and up to 12 (assumed noon) for Saturday.

Successful posts tend to include:

Crystal version
Database connectivity used (can greatly imporve performance)
Example data
Expected output

-k
 
lbass, my apologies for not replying sooner (out of office) - we run a 24hr operation here with shifts split from 05:00 to 21:00, however I was looking for analysis by day initially (eg Monday 05:00 - Tuesday 05:00) and then for complete weeks
 
Try creating a formula like:

//{@shiftstart}:
dateadd("h",-5,{table.datetime})

This should bring all the times within one start day. If you group on this, on change of week, and then insert a second group on it on change of day, you should be able to insert summaries and get the correct data.

-LB



 
lbass

Much appreciated... this works perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top