Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: string manipulation Post Reply Post New Topic
Author Message
blkhills
Newbie
Newbie


Joined: 27 Feb 2007
Location: United States
Online Status: Offline
Posts: 2
Quote blkhills Replybullet Topic: string manipulation
    Posted: 27 Feb 2007 at 3:28pm
I'm a newbie, first report I ever worked on.  I have a text field that has dates entered into it (9/30/2007).  This field needs to be in my where criteria.  I would like to have the user enter a date range and then check this field and return records within this date range.  How do you convert a text value to a date value?
 
Thanks
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Feb 2007 at 7:52pm
To convert a string to a Crystal Report date, use the CDate(field) function. You can find more functions in my free online chapters.
http://www.crystalreportsbook.com/Chapter06_XI.asp
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
blkhills
Newbie
Newbie


Joined: 27 Feb 2007
Location: United States
Online Status: Offline
Posts: 2
Quote blkhills Replybullet Posted: 28 Feb 2007 at 9:00am
I appreciate your efforts to help.  I have seen the same information in the help screens of Crystal but since I've never had a Crystal class, never even opened the program until yesterday, I'm at a loss as how to apply the CDate function.  In Crystal "Select  Expert" I have added a tab for the field id_6 which is my text field, used the 'formula' choice and tried CDate{Workstat.ID_6} <="07/01/2007".  Am I approaching this correctly?
 
I should add the fact that the values in the field are already in a date format.  I have also tried the following
If ISDate({Workstat.ID_6}) Then
Formula CDate({WORKSTAT.ID_6}) <= 07/01/2007
EndIf
 
or If ISDate({Workstat.ID_6}) Then
Formula CDate({WORKSTAT.ID_6}) <= "07/01/2007"
EndIf


Edited by blkhills - 28 Feb 2007 at 9:10am
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 28 Feb 2007 at 9:24am
To keep things simple, I would first create an independent formula just to convert the string to a date. It's only code would be:
CDate({WORKSTAT.ID_6})

Then I would use the select expert and pick this formula as the new tab and say that it is less than 07/01/2007. That way you're not trying to do too much at one time. Plus, you should read my free online chapters. They will teach you how to go about creating formulas.



Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.016 seconds.