COARRI and CODECO EDI Sample Code C#
I want to read CODECO and COARRI EDI Files in c#. How to read any examples can you share?
-
Hello,
You read any transaction file in exactly the same way as the rest. So for COARRI:
var ediStream = File.OpenRead("C://yourcoarrifile.txt");
List<IEdiItem> ediItems;
using (var ediReader = new EdifactReader(ediStream, TemplateFactory.TrialTemplateFactory))
ediItems = ediReader.ReadToEnd().ToList();
var transactions = ediItems.OfType<TSCOARRI>();and for CODECO:
var ediStream = File.OpenRead("C://yourcodecofile.txt");
List<IEdiItem> ediItems;
using (var ediReader = new EdifactReader(ediStream, TemplateFactory.TrialTemplateFactory))
ediItems = ediReader.ReadToEnd().ToList();
var transactions = ediItems.OfType<TSCODECO>();The template factory resolves the correct transaction. The trial only works with version D96A so when you test your files ensure that they are D96A version.
Please sign in to leave a comment.
Comments
2 comments