Separating Date/Time field into two separate Parameters

Fielded Statement

I am trying to take the requests.Req_Date field and separating it into two parameters so the date and time can be searched independantly.

For example if I want to know only the requests created between 1 AM and 5 AM  on days 12/1/08 - 12/15/08.

Is there a way to do this in crystal?



It is possible to use separate date & time parameters to perform that sort of search.

However, requests.Req_Date is not populated with time information, it is only populated with date information, so you cannot perform a time based search on this field.

That said, to perform this sort of search on fields with both date and time information, you would need to create two parameters, setting both to allow range values, and make one of type 'Time' and the other of type 'Date'. Then create 4 formulas; start date, end date, start time & end time, using the MAXIMUM() and MINIMUM() functions to capture the relevant data from the parameters. Once that is complete you could add a formula like the following to the selection criterion (via the select expert):


 DATE({datetimefield}) >= {@Start Date} AND

 DATE({datetimefield}) <= {@End Date} AND

 TIME({datetimefield}) >= {@Start Time} AND

 TIME({datetimefield}) <= {@End Time}



Please sign in to leave a comment.