EDI.Net
EDI.Net copied to clipboard
Read a file with 1 or more Interchange
Hi all, First let me thank you for your wonderful and helpful library. I started working in a company who uses EDI, and being curious I started playing with these messages, that´s when I found your library. I´m no a programmer but attached is my attempt to create a dictionary for CODECO / COPARN / COARRI messages, that I share with you to use as you see fit. EDI.zip
I hope you can help me with a petit challenge I have ... I´m trying to read CODECO messages from a partner from a file with one or more Interchange but I can only read the last one. Also the same partner mixes CODECO and COARRI files (in different files but on the same folder). This is a real example codeco.txt
I need your help to:
- read multiple interchange messages in the same file?
- how to infer which grammar to use per file? In this case I´m doing a search the word CODECO or COPARN in the text before Deserialize ...
Also any comment on the messages is good...
Thank you again for your library
Hi @FRConceicao and thanks for your interest in EDI.Net. Also thanks for sharing your work.
- I have not come across a transmission with multiple interchanges yet but nothing seems to surprise me since I started this project. Usually there are multiple functional groups that contain different message types and I use EdiCondition attribute to discriminate between them. Since this is not the case I suppose that if the a text reader is passed to the EdiTextReader constructor and not disposed after deserialization of a single interchange one could try to do a while loop and deserialize again until the end of the file. But that is just a theory and you must check if the Deserialize method returns after the first UNZ ends with state closed.
- I am not sure I understood the question. In the normal case of a single interchange file this is achieved using the Service String Advice Tag
UNA
. I suppose you mean when there are multiple transmissions in the same file with different grammars. Again I would expect each transmission to begin with its own UNA tag if there are different grammars involved.
As far as your sample go I must say that although my look was superficial you have done a wonderful job. I like that u make use of both the EdiSegment and EdiElement containers and that you use the wildcard paths where possible. Also I like that use a variation in your CLR value types (I don't always bind to string but when possible I use integers, dates, decimals, and even enums).
That said I would suggest that you could put the code out there in its own repo. Another thought would be with your permission to add the models to a separate project inside the same solution as indice.Edi.Edifact and you to become a contributor.
Kind Regards,
C.
@cleftheris , thank your for your reply.
My programming skills are very limited, I tried reading your code up and down to check what you said about " if the Deserialize method returns after the first UNZ ends with state closed.", but I cannot understand it, it´s out of my depth.
As for the samples I gave, please use as if they were yours. I only took some ideas from all the posts and compile them to try to use it. For the same reason above I thank you for your offer but I´m not skilled enough to be a contributor. I love the idea of a separate project and maybe some else is interested and I´ll keep posting any new dictionary I came up with.
Thank you @cleftheris
Francisco