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

X12 - Including the same segment name under different segment-groups #27

Closed
wainlake opened this issue Nov 8, 2016 · 4 comments
Closed
Assignees
Labels

Comments

@wainlake
Copy link

wainlake commented Nov 8, 2016

Hi @cleftheris , we got a 850 X12 file from our partner, it include the element 'MSG' in multi segments. We created a C# class to deserialize it, but can not get 'MSG' value in PO detail. How to fix this problem?Thanks.

850 edi & C# class:X12_850.zip
850 Spec:
850 spec

@cleftheris cleftheris self-assigned this Nov 8, 2016
@cleftheris
Copy link
Contributor

@wainlake I am currently looking into this

@cleftheris
Copy link
Contributor

cleftheris commented Nov 10, 2016

@wainlake
The main problem with how you have modelled your classes is the following:

You have decorated the DTM class to always create a new structural group using the SegmentGroupAttribute. This is not the case for DTM as it is not defining a segment-loop by itself. Also this structure did not declare a terminating marker (SequenceEnd segment) thus the deserializer was trying to put everything after the DTM (TC2,MSG, etc...) under that class.

Checkout an improved version of your PurchaseOrder class

If this resolves your problem please tell me, so I can close the issue

Thanks

@wainlake
Copy link
Author

@cleftheris Thanks. Or perhaps I'm making too much of it. It's fine now. EDI.NET is too nice.

The other question is about the data type. If I defined one element as "9(2)" and the given value is 1,it'll serialize to "Z1".How to fix it?

Btw, I think the SE Segment should be located at the bottom of transaction set, is it a clerical error?

@cleftheris
Copy link
Contributor

cleftheris commented Nov 11, 2016

@wainlake glad to hear its working out for you.
So about your questions

  1. As a workaround mark the picture as 9(1). For the explanation: The thing with picture syntax is that I have not made up my mind how to treat it when we are serializing back to edi text file. I have an open ticket where I am thinking about this Revisit the formatting and the PICTURE syntax. #23. The Z is commonly used for padding a number that would otherwise have to be fixed length when represented as text. Say for the number 24 when written to text in a edi component with a fixed length of 3 then it must be padded as ether Z24 or 024 or even 24. I am trying to figure out what is the best way to handle this.
  2. for well known structural segments such as those that mark the interchange, group, and message boundaries the order is well known internally and the values are sorted before writing no matter how they are laid out inside your class. For all the other segments the order is important. Internal values found on segments (Component) on the other hand are already indexed so the order is taken care of by the path.

@cleftheris cleftheris changed the title How to deserialize X12 waht include same element in multi segments How to deserialize X12 - Including the same segment name under different segment-groups Nov 11, 2016
@cleftheris cleftheris changed the title How to deserialize X12 - Including the same segment name under different segment-groups X12 - Including the same segment name under different segment-groups Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants