Print Page | Close Window

Parameter: by year

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19520
Printed Date: 05 May 2024 at 10:34pm


Topic: Parameter: by year
Posted By: Ariel
Subject: Parameter: by year
Date 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?



Replies:
Posted By: DBlank
Date 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


Posted By: Ariel
Date 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.


Posted By: DBlank
Date 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}


Posted By: Ariel
Date 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!



Print Page | Close Window