Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Text to Year Post Reply Post New Topic
Author Message
Ricci
Newbie
Newbie
Avatar

Joined: 09 Jul 2012
Location: United States
Online Status: Offline
Posts: 8
Quote Ricci Replybullet Topic: Text to Year
     Posted: 29 Jan 2013 at 5:29am

I am filtering a report for a specific year. Right now I am prompting the user to enter any date from the target year and then using Year(x) to pull out the needed year. However the environment where the report is published gives them an error message if they try to click the calendar to select a date. Typing a date works but they want to click the little calendar.

Is there a way I can prompt them to simply key in the year as a text  (i.e. 2012) and convert that to a date? I tried cDate(x) but it wants a full date spelled out and Year(x) requires a date field. Finding a way to make this work will be easier than asking the users not to click the calendar icon. Ouch

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Jan 2013 at 5:57am
I would use a numeric field and not text to avoid users from entering in the yy instead of yyyy
you can put min and max values on the param to formce them to stay in a range
from there you can just use
year(table.date)={?param}
 
if you want to to use text you can use
year(table.date)=tonumber({?param})
but it will fail if they dont type in all numbers and all 4 digits
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