EdiEngine icon indicating copy to clipboard operation
EdiEngine copied to clipboard

ISA not found

Open denniselit opened this issue 3 years ago • 3 comments

Hi,

Im fairly new to EDI and tries to convert an EDIFACT message to json or XML with EdiEngine, however the files I receives does not start with ISA (since it's EDIFACT and not X12 i think?).

Is there a way to work around or fix this with EdiEngine?

The structure in the files I receive looks like this (https://learn.microsoft.com/en-us/biztalk/core/edi-headers-and-trailers):

UNA Service String Advice  
UNB Interchange Control Header  
  UNG Functional Group Header  
    UNH Message Header  
    UNT Message Trailer  
  UNE Functional Group Trailer  
UNZ Interchange Control Trailer

Code:

        var edi = File.ReadAllText(path);
        EdiDataReader r = new EdiDataReader();
        EdiBatch b = r.FromString(edi.Trim());

        //Serialize the whole batch to JSON
        JsonDataWriter w1 = new JsonDataWriter();
        string json = w1.WriteToString(b);

        //OR Serialize selected EDI message to Json
        string jsonTrans = JsonConvert.SerializeObject(b.Interchanges[0].Groups[0].Transactions[0]);
        
        //Serialize the whole batch to XML
        XmlDataWriter w2 = new XmlDataWriter();
        string xml = w2.WriteToString(b);

Best regards!

denniselit avatar Nov 03 '22 12:11 denniselit

Hi DennisEdiEngine doesn’t support EdiFact unfortunately. I don’t have maps and parser implemented. Only X12 is supported.Best regards,OlegOn 3 Nov 2022, at 12:06, Dennis Wetterlund @.***> wrote: Hi, Im fairly new to EDI and tries to convert an EDIFACT message to json or XML with EdiEngine, however the files I receives does not start with ISA (since it's EDIFACT and not X12 i think?). Is there a way to work around or fix this with EdiEngine? The structure in the files I receive looks like this (https://learn.microsoft.com/en-us/biztalk/core/edi-headers-and-trailers): UNA Service String Advice
UNB Interchange Control Header
UNG Functional Group Header
UNH Message Header
UNT Message Trailer
UNE Functional Group Trailer
UNZ Interchange Control Trailer

Code: var edi = File.ReadAllText(path); EdiDataReader r = new EdiDataReader(); EdiBatch b = r.FromString(edi.Trim());

    //Serialize the whole batch to JSON
    JsonDataWriter w1 = new JsonDataWriter();
    string json = w1.WriteToString(b);

    //OR Serialize selected EDI message to Json
    string jsonTrans = JsonConvert.SerializeObject(b.Interchanges[0].Groups[0].Transactions[0]);
    
    //Serialize the whole batch to XML
    XmlDataWriter w2 = new XmlDataWriter();
    string xml = w2.WriteToString(b);

Best regards!

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

olmelabs avatar Nov 04 '22 08:11 olmelabs

See above

olmelabs avatar Nov 02 '23 22:11 olmelabs

^^

olmelabs avatar Nov 02 '23 22:11 olmelabs