Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Data Parameter Post Reply Post New Topic
Author Message
Logically
Newbie
Newbie
Avatar

Joined: 12 Jun 2013
Location: Ireland
Online Status: Offline
Posts: 5
Quote Logically Replybullet Topic: Data Parameter
     Posted: 09 Dec 2013 at 1:32am
Hi All,
I need to create a data parameter, which I have been successfully done in the past as follows:
 
1. Create the parameters
2. Place the parameters within the selection expert:
creating a selection criteria :
{table.datefield} >= {?Paramter1} and {table.datefield} <= {?Parameter2}
 
The problem I am  encountering on this occassion is that the field I am need to restrict based on is a DateTime field.
 
I know I can use the same approach as above and have the user enter/select the date and time.
 
But I want to simplify the data entry for the end-user.
 
So is it possible to have the user enter/select a date and then have the data converted to DateTime for use within the selection expert?
 
All help and feedback warming welcome.
 
Rgds
Logically.
 
 
ONLY learning
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Dec 2013 at 5:15am
I would think that you could have the user enter a string, then us a conversion to get a dateatime variable...even 2 if it is for a given date...or have the user enter 2 datetime strings so you can have a begin and end date. You can add the time to be the end of the date and then proceed as you normally would.

HTH
IP IP Logged
lolly54
Groupie
Groupie
Avatar

Joined: 25 Sep 2011
Online Status: Offline
Posts: 58
Quote lolly54 Replybullet Posted: 09 Dec 2013 at 9:38pm
What are the parameter type? Did you select "Date" or "String" field? (there's a "Date Time" type also).

If you select the Date or Date Time type, the report will prompt the user to enter a date or select from a calendar. Crystal Reports will then convert that into the date type and you do not have to do anything extra.

Or else, you can put convert the parameter in your selection condition with "cdate", "Datevalue", "DateTimeValue".

{table.datefield} in cDate({?Paramter1}) to cDate({?Paramter2})

(btw, I prefer using in....to when dealing with the date period).

Hope it help! :)
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 09 Dec 2013 at 10:13pm
Hi

Yes, you can create only date prompt and that parameter can be converted into datetime in record selection.  But when you convert date to datetime it will take time stamp as 12:00:00 am.  If that works for your logic use below selection formula .

{table.datefield} >= datetime({?Paramter1}) and {table.datefield} <= datetime({?Parameter2})
Thanks,
Sastry
IP IP Logged
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