Does anyone have any suggestions on how to search a TEXT field for any date, check it against the current date to see if it is in the past or older than the current date?
I have a TEXT field on my item card named ETADate that we use to put information like "ETA 12/20/2010" or "ETA 12-20-10 NEW ITEM".
To clarify things I will be setting to blank when an older date is found:
ETADate := '';
// Save the modification, commit blah blah
I'm going to create a processing only report to clean up old ETADate information and was wondering if anyone had an easy way to find an older date in a string?
Half-empy or half-full how do you view your database?
Thanks.
0
Answers
This assuming that the Date portion is after the first blank.
DateStr is Text and DateVar is Date
Hope this points you in the right direction
1. In your code you are saying IF the position of the first blank space is greater than 0 then copy from that position into DateStr.
2. So DateStr was "ETA 12-10-10 NEW ITEM" and would become "12-10-10 NEW ITEM".
3. Then you run DateStr through again and it copies from position 1 of DateStr to the position of the next blank space so I should end up with "12-10-10".
4. After that it looks like you're using DELCHR to remove anything that is not number like the "-" hyphens or "/" slashes normally found in date strings.
5. Finally you are using EVALUATE on DateStr which is currently "121010" to put it into DateVar as a valid date for comparison.
Did I follow this correctly?
I think I got it now, but what it I have blank spaces at the beginning of the field and also before and after the actual date?
I'm going to give this a try:
Thanks.
http://www.BiloBeauty.com
http://www.autismspeaks.org
If there are spaces in the begining of the field you can replace the datestr := statement to
DateStr := DLECHR(ETAField,'<>',' ');
This will delete all the leading and trailing spaces.
RIS Plus, LLC