Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: convert string to a date format.... Post Reply Post New Topic
<< Prev Page  of 3
Author Message
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jan 2014 at 5:26am
so I understand, that means if i were reading the memo field it would be the very last time that the string of
> Sent: MM/dd/yyyy h:mm PM
appears in the text.
That is the date you want to use as a filter...correct?


Edited by DBlank - 15 Jan 2014 at 5:27am
IP IP Logged
jwilliams
Newbie
Newbie


Joined: 23 Nov 2013
Online Status: Offline
Posts: 12
Quote jwilliams Replybullet Posted: 15 Jan 2014 at 5:30am
That is correct!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jan 2014 at 5:58am
This will be slow.... but should work
stringvar t1;
stringvar t2;
datevar d1;
 
WhileReadingRecords;
t1 := mid({table.memofield},instrrev({table.memofield},"> Sent: ")+8);
t2 := left(t1,instr(t1,"M"));
d1 := date(t2);
 
d1
IP IP Logged
jwilliams
Newbie
Newbie


Joined: 23 Nov 2013
Online Status: Offline
Posts: 12
Quote jwilliams Replybullet Posted: 15 Jan 2014 at 6:01am

Thank you.

I'm gettin an error    
 
Bad Date format string on   d1 := date(t2);
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jan 2014 at 6:09am
you will have to run each part of this seperately to see what is going on and debug it.
I assumed that you have a format on the process that inserts the data into the memo field so I went with your sample memo field.
create a formula field as
 
stringvar t1;
 
WhileReadingRecords;
t1 := mid({table.memofield},instrrev({table.memofield},"> Sent: ")+8);
 
t1
that should return a string that starts with the date field you wanted to extract (but also includes the whole notation).
If that is correct move to the next part and see what t2 returns. It should trim off the everything right of the AM or PM on the date field.
 
IP IP Logged
blowinup
Newbie
Newbie


Joined: 09 Apr 2014
Online Status: Offline
Posts: 8
Quote blowinup Replybullet Posted: 09 Apr 2014 at 8:49am
Originally posted by Seabass

dave... look like i got it... i change a few bracket and add spaces and it work as intended !!!!


 

Thanks


It would have been nice if you had shared the edits you made to get it to work.
IP IP Logged
<< Prev Page  of 3
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.