Hi,
Is there a way to read in x12 edi documents and transform them to csv files without having to read the whole file as 1 record, split record inside the reformat component to create a list of elements then pulling values from list to map to output metadata?
It works but I’m just wondering if there’s any other way to do it using the available components in the designer.
Thanks.
Hi,
Yes, EDI documents in general should be possible to read using the ComplexDataReader or the MultiLevelReader component. These components are quite similar, the main difference is that ComplexDataReader is configured via user friendly GUI editor, wheres to steer the MultiLevelReader you have to write some Java code.
The main idea is that you create a state machine which decides how to parse next chunk of the document. Each state is associated with Clover metadata, and the structure (fields) of the metadata decide how the next part of the document is parsed. So (very loosely speaking, sorry) you would create metadata according to individual EDI segments which can appear in your document, create states of the state machine for these metadata and then define possible transitions between these states (e.i. how can one EDI segment follow another one in your document), e.g. you can specify that if next few characters in the document are “FOO” (i.e. prefix of an EDI segment) go into state $3 (which will parse next document part according to its metadata).
I think you would get a better idea how to parse non-homogenous text files using the ComplexDataReader by looking at examples in our RealWorldExamples project, namely the graphParsingTextData.grf and graphReadingComplexData.grf graphs. (To create the example project in the Clover Designer, click File → New → Example… → CloverETL Examples Project → check RealWorldExamples → Finish.)
Also, you can have a look at the documentation: http://doc.cloveretl.com/documentation/UserGuide/topic/com.cloveretl.gui.docs/docs/complexdatareader.html
Regards,
Tom
Hi Tom,
Thanks for the response. I’ll give the complex data reader a try.
By the way, I’m also trying to write out an edi document. I wonder which writer is the best one to use in writing out edi docs. Any thoughts?
Hi pOctavian,
most similar opposite component to ComplexDataRader is http://doc.cloveretl.com/documentation/ … riter.html