May 02, 2011, 09:39 AM
Gayle DeGennaroWays to trap for a bad date in Data Migrator?
We are pulling data from a Unidata system. One of the data fields is student's birth date. My challenge is that we have some birth dates that are wrong in our transactional system and Data Migrator does not like them (i.e., 10/21/0825). I was thinking one way to handle this is to check to see if the date is valid and if it is pull it into my Student Dimension. If it is not valid, I will transfer in a null value. Also, our transactional system for some reason is seeing these strange dates as "valid".
My question for the group is, do you know of a way to check for a "valid" date format? Or, do you have any other suggestions on how I might handle this?
Also, we are currently at 7.6.10 but are upgrading our system on Thursday, May 5 to 7.7.2.
May 03, 2011, 03:22 PM
ERINPHi Gayle,
The only approach I can think of would be to parse the date field into variables for MM(>0 <=12 taking into account months 2,4,6,9,& 11 are <31 days), DD[>0 <=31), and YYYY [if it doesnt start with 19 or 20) then use a java_script routine to check each of these variables. If they do not fail on the above conditions then concatenate them back together for display purposes. It would be nice if webFOCUS had an ISDATE function to verify it is indeed a "true" date.
May 03, 2011, 05:27 PM
ClifIt depends on how bad the dates can be. If the slashes are always going to be there you can remove them with EDIT, and then use DATECVT to convert the date to your desired format.
DATECVT( EDIT (INDATE, '99$99$9999') , 'A8MDYY', 'MDYY' )
This returns a blank for invalid date which you can convert to MISSING to insert a NULL.
May 13, 2011, 01:32 PM
Gayle DeGennaroI think both of these suggestions will work. I'll try them out this afternoon.
Thank you so much!
May 14, 2011, 12:21 PM
Dan SatchellPrior ro using DATECVT, as Clif suggests, you might use the CHKFMT function to ensure the incoming date has slashes in the correct places and all numbers otherwise:
DATE_CHECK/I3 = CHKFMT(10,INDATE,'99/99/9999','I3');
BIRTH_DATE/MDYY MISSING ON = IF (DATE_CHECK NE 0) THEN '' ELSE DATECVT(EDIT(INDATE,'99$99$9999'),'A8MDYY','MDYY');