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

Repeating element groups within segment for X12 830 #252

Open
EugeneStepan opened this issue Feb 21, 2024 · 1 comment
Open

Repeating element groups within segment for X12 830 #252

EugeneStepan opened this issue Feb 21, 2024 · 1 comment
Labels

Comments

@EugeneStepan
Copy link

I am trying to parse a X12 830 file, and I am struggling to properly handle the LIN segment.

Within the LIN segment, after the 1st element which is an ID for the LIN loop, it begins alternating between "Product/Service ID Qualifier" and "Product/Service ID". Only the first alternation is required in the specs, but it is capable of alternating 15 times total.

I would like some guidance on how to handle this in three different ways, the first, which is probably going to be more valuable for my use-case, is to use conditions to store the pair of values in objects, as we know the qualifiers that we should be looking for.

The second way I would handle it is to get a list of the potential 15 product/services without explicitly defining each property separately. I am not sure how to loop through this alternating elements similar to how you would handle repeated segments.

The third way, which would be the most robust at handling custom scenarios like this but it the least ideal, would be to be able to store the entire segment in a string and parse it manually. I'm unsure how to do this after looking through documentation.

Below is an example LIN segment that I'm referring to.

LIN*00010*BP*AFH203668*EC*A*CR*5500164382*PD*TIE BAND, FIR TREE MOUNT~

Broken down, the repeating alternations end up being as follows:

1: BP*AFH203668
2: EC*A
3: CR*5500164382
4: PD*TIE BAND, FIR TREE MOUNT
@cleftheris
Copy link
Contributor

Hi @EugeneStepan, you should take a look at the tests section for examples. What you would be interested in how the SegmentGroup attribute is used https://github.com/indice-co/EDI.Net/issues?q=is%3Aissue+SegmentGroup

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