Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Date and Time Post Reply Post New Topic
Page  of 2 Next >>
Author Message
barnwpk
Newbie
Newbie
Avatar

Joined: 14 Dec 2011
Location: United States
Online Status: Offline
Posts: 9
Quote barnwpk Replybullet Topic: Date and Time
     Posted: 14 Dec 2011 at 8:40am
Need a report that captures all tickets that are created.... only between the hours of 5:30pm and 7:30 am each day for the past month. 
 
date and time field is called TikALL.TicketDateTime.  
Example of data in this field field looks like .....   12/1/2011 10:56:49AM
 
Any help would be greatly appreciated.
Thank you.


Edited by barnwpk - 14 Dec 2011 at 8:42am
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 14 Dec 2011 at 9:03am

if you dont need compound select

datepart('m',{TicketDateTime})={parameter month}
and
timevalue({TicketDateTime}>=timeserial(17,30,0) and
timevalue({TicketDateTime}>=timeserial(7,30,0)
 
 
I am sure this can be shortened, this is all I could think of offhand
 
this may work

DateTime (CDate ({TicketDateTime}), CTime("5:30pm")) >={TicketDateTime} and

DateTime (CDate ({TicketDateTime}), CTime("7:30pm")) <={TicketDateTime}



Edited by comatt1 - 14 Dec 2011 at 9:08am
IP IP Logged
barnwpk
Newbie
Newbie
Avatar

Joined: 14 Dec 2011
Location: United States
Online Status: Offline
Posts: 9
Quote barnwpk Replybullet Posted: 14 Dec 2011 at 9:21am
Thank you so much COMATT1.  That works perfectly.  I have been staring at this for so long.  Thank you....Thank you.
IP IP Logged
barnwpk
Newbie
Newbie
Avatar

Joined: 14 Dec 2011
Location: United States
Online Status: Offline
Posts: 9
Quote barnwpk Replybullet Posted: 15 Dec 2011 at 2:49am
Another question....
This works great for all the days of the week.
 

timevalue({TikALL.TicketDateTime})>=timeserial(17,30,0) or

 timevalue({TikALL.TicketDateTime})<=timeserial(7,30,0)
 
How do I get the above formula for M-F information, and on the weekend I need it to look at all time frames. The weekend needs to capture all information no matter what the time....and M-F only needs to capture information between 5:30pm and 7:30am.   
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 15 Dec 2011 at 2:58am

if not(weekday(CDate ({TicketDateTime}))) in ['1','7'] then

timevalue({TikALL.TicketDateTime})>=timeserial(17,30,0) or

 timevalue({TikALL.TicketDateTime})<=timeserial(7,30,0)
IP IP Logged
barnwpk
Newbie
Newbie
Avatar

Joined: 14 Dec 2011
Location: United States
Online Status: Offline
Posts: 9
Quote barnwpk Replybullet Posted: 15 Dec 2011 at 3:21am
I get an error "boolean is required" on the highlighted section below.
 
if not(weekday(CDate({TikALL.TicketDateTime})))in['1','7']then
timevalue({TikALL.TicketDateTime})>=timeserial(17,30,0) or
timevalue({TikALL.TicketDateTime})<=timeserial(7,30,0)
IP IP Logged
barnwpk
Newbie
Newbie
Avatar

Joined: 14 Dec 2011
Location: United States
Online Status: Offline
Posts: 9
Quote barnwpk Replybullet Posted: 15 Dec 2011 at 6:09am
This statement runs without error, but doesn't bring back info for the weekends
 
if not (weekday ({TikALL.TicketDateTime}) in [1,7]) then
timevalue({TikALL.TicketDateTime})>=timeserial(17,30,0) or
timevalue({TikALL.TicketDateTime})<=timeserial(7,30,0)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Dec 2011 at 6:22am
maybe this...
{TikALL.TicketDateTime} in lastfullmonth
and
(
(weekday ({TikALL.TicketDateTime}) in [1,7])
or
(time({TikALL.TicketDateTime})>=time(17,30,0) or
time({TikALL.TicketDateTime})<=time(7,30,0) )
)
IP IP Logged
barnwpk
Newbie
Newbie
Avatar

Joined: 14 Dec 2011
Location: United States
Online Status: Offline
Posts: 9
Quote barnwpk Replybullet Posted: 15 Dec 2011 at 7:29am
yes..That worked perfectly.  Thank you so much.
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 15 Dec 2011 at 8:48am
Oops, I should have checked before submitting, sorry, thanks DBLANK
IP IP Logged
Page  of 2 Next >>
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