Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: search date Post Reply Post New Topic
Author Message
jack123
Newbie
Newbie


Joined: 24 Apr 2015
Location: Canada
Online Status: Offline
Posts: 2
Quote jack123 Replybullet Topic: search date
     Posted: 24 Apr 2015 at 11:05am
I'm looking for a formula that will search a list to see if it is a date.  I have a list of numbers as follows:

M05899
M06125
L15214
013114
M06828
M06901

From the list above 013114 is a date and the other strings are invoice numbers.  In particular I would like to know if the date listed is the last date of any particular month or year.  In other words it should not be any date, but specifically the last date of any month or year.  I believe this may be done with an if and then type of clause but wondering if there is a better way.  I couldn't find a date function in the formula editor that would do this.  Any help would be greatly appreciated.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Apr 2015 at 4:30am

if isdate(Left({table.DateField},2)+'/'+mid({table.DateField},3,2)+'/'+right({table.DateField},2)) then

(if month(dateadd('d',1,date(Left({table.DateField},2)+'/'+mid({table.DateField},3,2)+'/'+right({table.DateField},2)))) = month(date(Left({table.DateField},2)+'/'+mid({table.DateField},3,2)+'/'+right({table.DateField},2))) then 'Date'

else 'Date-Month End') Else 'Not a date'

IP IP Logged
jack123
Newbie
Newbie


Joined: 24 Apr 2015
Location: Canada
Online Status: Offline
Posts: 2
Quote jack123 Replybullet Posted: 27 Apr 2015 at 5:23am
Thank you very much! You're awesome!

Edited by jack123 - 27 Apr 2015 at 5:24am
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