Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISA not found #32

Open
denniselit opened this issue Nov 3, 2022 · 3 comments
Open

ISA not found #32

denniselit opened this issue Nov 3, 2022 · 3 comments

Comments

@denniselit
Copy link

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!

@olmelabs
Copy link
Owner

olmelabs commented Nov 4, 2022 via email

@olmelabs
Copy link
Owner

olmelabs commented Nov 2, 2023

See above

@olmelabs
Copy link
Owner

olmelabs commented Nov 2, 2023

^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants