Hi,
I need to build a date from text so I can use it in an Aging calculation. The client uses part of the Lot No. to represent Manufacturing date, so that the first five characters of the Lot No. 08126-FG-082 equals the 126th day of 2008 (first 2 characters 08 = 2008, next 3 characters 126 = 126th day of the year). I need to print the Mfg. Date on the report, then do an aging calculation so I can show Days Aged in the next column. I have gotten as far as using the Evaluate function to convert the characters to date -
String:='08126';
EVALUATE(D,COPYSTR(String,3,3));
EVALUATE(M,COPYSTR(String,5,2));
EVALUATE(Y,COPYSTR(String,1,2));
MfgDate:= DMY2DATE(D,M,Y);
However, I am missing M, so this isn't working very well...any ideas? :?
Thanks!
Leanne G. Paul
Business Applications/IT Advisor, Competitive Edge Services
0
Comments
You could use the Date virtual table. Filter the table to show records of type "Date".
Filter the records to show only the year's dates. Then do a DateRec.NEXT(126);
Could such a thing work :-k (It should...)
Thanks - it worked - sort of! It works on the first record (I am using Item Ledger Entries in a report). When it moves to the next record, it does not seem to be starting at the first record in the filter when it finds the NEXT date, even though I have done a RESET on the record variable. Here is the code:
DateTable.RESET;
fromdate:=DMY2DATE(1,1,mfgyear);
todate:=DMY2DATE(31,12,mfgyear);
DateTable.SETFILTER("Period Type",'=Date');
DateTable.SETRANGE("Period Start",fromdate,todate);
DateTable.NEXT(Day);
MfgDate:=DateTable."Period Start";
For example, on the first record, Day=126, indicating the 126th day of 2008, so MfgDate=5/5/08. On the next record, Day=150, so MfgDate=5/29/08. However, the program sets MfgDate to 10/02/08. 10/02/08 is the 276th day of 2008, 150 + 126 =276, so what it is doing is starting at the last date it found and adding the next value.
Does RESET work differently with Virtual Tables?
Thanks again!
Business Applications/IT Advisor, Competitive Edge Services
RIS Plus, LLC
MVP - Business Apps
RIS Plus, LLC
MVP - Business Apps
I didn't clear it out... My post was referring to lgp's post.
RIS Plus, LLC
MVP - Business Apps
I had the brainstorm about the FINDFIRST last night - and that worked. Thanks so much for all the responses! DenSter - I tried your code but I couldn't retrieve the year from TODAY or WORKDATE.
Business Applications/IT Advisor, Competitive Edge Services
RIS Plus, LLC
MVP - Business Apps