Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Parameter: by year Post Reply Post New Topic
Author Message
Ariel
Newbie
Newbie


Joined: 10 Jun 2010
Location: United States
Online Status: Offline
Posts: 33
Quote Ariel Replybullet Topic: Parameter: by year
    Posted: 09 May 2013 at 9:55am
I have a report that a user wants to be able to pull all records by year - on a datetime field.  I'm not sure how to do this.  I created a formula to change the datetime field into year only but then the paramenter is looking for a whole date.  When I changed the parameter to String then I got an error while using a datetime field.
Can anyone help?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 May 2013 at 2:16am
are you haveing the user type in the year in a param?
if so make the param numeric and apply min and max values to force that they use full 4 digits for the year and to help reduce user typo errors.
in your select formula use
year(table.datefield)=?param
IP IP Logged
Ariel
Newbie
Newbie


Joined: 10 Jun 2010
Location: United States
Online Status: Offline
Posts: 33
Quote Ariel Replybullet Posted: 14 May 2013 at 5:36am
Yes they want to type in a year (example:  2012) and it will pull all records that have a certification in the year 2012.  I added Year to the formula in the select expert but I got an error.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 May 2013 at 6:00am
did you create a numeric parameter named 'Certification Year' with min and max values (like min of 2000 and max of 2099)?
in your select expert use:
year({yourtable.yourdatefield})={?Certification Year}
IP IP Logged
Ariel
Newbie
Newbie


Joined: 10 Jun 2010
Location: United States
Online Status: Offline
Posts: 33
Quote Ariel Replybullet Posted: 14 May 2013 at 6:14am
Sorry, I went back and had to change the parameter to Number instead of datetime - it worked!  Thanks so much!
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.018 seconds.