This project has moved and is read-only. For the latest updates, please go here.

OopFactory.X12.ImportX12 | Date Parsing | Receiving Errors Parsing Valid Date

Aug 5, 2015 at 3:36 PM
I have a good number parsing errors related to the format dates are being submitted to me in. Here's an example of the message:

"Element FST04 in position 11 of interchange 1 cannot be indexed because '150722' could not be parsed into a date."

This is all related to the Individual Segment tables that are being built, in this case I'm receiving an 830, so when the FST Segment is being indexed, it fails when trying to parse my date format of '150722'.

Before I start digging into the source code and trying to modify this, has anyone else run into this before and come up with a way to traverse it? I can see if the vendor can modify their date format, but their spec document is from 2004, so I'm not sure its a change easily made.
Aug 5, 2015 at 4:01 PM
The parser attempts to infer the datatype to use for each element from the spec, but this only happens the first time the import is run against the database. Once the FST table is created you can manually change the data type of [04] to be a varchar so that this error won't occur.
This will allow you to parse the date manually when you query that field.
The definition of FST04 is a date with min and max length of 8, though I can understand it might be difficult to get some partners to change their code to conform to the standard.
Marked as answer by ChaseWI on 8/5/2015 at 9:56 AM
Aug 5, 2015 at 5:07 PM
Thanks for the reply. I didn't even consider that this was failing on the database side, I figured the application was trying to parse the date before the insert.

I went ahead and updated the spec to generate the date fields as nvarchar data types to I don't have to drop and recreate the tables after the initial import.

Thanks again for the quick response!