Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Tips and Tricks
Message Icon Topic: date range Friday noon to Sunday noon Post Reply Post New Topic
Author Message
jimbo33
Newbie
Newbie


Joined: 12 Dec 2011
Location: United States
Online Status: Offline
Posts: 2
Quote jimbo33 Replybullet Topic: date range Friday noon to Sunday noon
    Posted: 12 Dec 2011 at 8:07am
Hi All -  I am trying to create a date range from every Friday noon to Sunday noon that checks vehicle mileage for that period.   The report would be run on Sunday afternoon.  I can't seem to get this to work. 
 
For the Friday start date :
 
if {CALENDAR_DAYS.CAL_DOW_NUM} = 6   then
DateAdd("H", 12, {CALENDAR_DAYS.CAL_DATE})
 
and for the Sunday date:
 
if {CALENDAR_DAYS.CAL_DOW_NUM} = 1 then
DateAdd("h", 12, {CALENDAR_DAYS.CAL_DATE})
 
I then set the record selection to:
 
{METER_JNL.METER_DATE} in DateTime (CDate({@startdate})) to DateTime (CDate({@Sunday}))
 
Any suggestions would be greatly appreciated.  Thanks.


Edited by jimbo33 - 13 Dec 2011 at 3:10am
jimbo33
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 13 Dec 2011 at 6:33am

I woudl just calculate the sunday value

if {CALENDAR_DAYS.CAL_DOW_NUM} = 1 then
DateAdd("h", 12, {CALENDAR_DAYS.CAL_DATE})
 
try outputting the formula to see what gets pulled.
 
then for your select; not able to test, but try
 
{METER_JNL.METER_DATE} in dateadd('h', -48,DateTime (CDate({@sunday}))) to DateTime (CDate({@Sunday}))
IP IP Logged
jimbo33
Newbie
Newbie


Joined: 12 Dec 2011
Location: United States
Online Status: Offline
Posts: 2
Quote jimbo33 Replybullet Posted: 13 Dec 2011 at 7:56am
That works !!! Thank you!
jimbo33
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.