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

Make unparsed child loops available in ASN #140

Closed
CodeSmell opened this issue Mar 4, 2022 · 0 comments · Fixed by #139
Closed

Make unparsed child loops available in ASN #140

CodeSmell opened this issue Mar 4, 2022 · 0 comments · Fixed by #139
Labels
enhancement New feature or request
Milestone

Comments

@CodeSmell
Copy link
Collaborator

Got an interesting file where a loop (the Order) had a child loop that was unexpected. That loop and its segments were not available to the user of Gozer.

One example is an Order loop with another Order loop as a child

HL*1**S
...

HL*2*1*O
...
HL*3*2*O

Another example is an Pack loop with another unknown loop as a child (in this case a loop of type X)

HL*9*5*P
...
HL*10*9*X

When the ASN parser is processing the children loops of the pack and does not recognize the loop code of X it will now add it as an unparsed child loop for the pack

parentLoop.addLoop(unparsedLoop);

which will make the data available as follows:

Pack pack = ...
// the known segments of a pack loop
List<MANMarkNumber> manList = pack.getManList();
...

// Gozer was already doing this for segments it did not recognize
List<X12Segment> unparsedSegments = pack.getUnparsedSegments();
...

// This is how to access the Item and other known child loops
List<X12Loop> items = pack.getParsedChildrenLoops();
...
// example of an unexpected child loop 
// that was not handled in the parser
List<X12Loop> unparsedLoops = pack.getUnparsedChildrenLoops();
X12Loop unparsedLoop = unparsedLoops.get(0);
// the segments for this loop are also available
unparsedLoop.getSegments();
@CodeSmell CodeSmell added the enhancement New feature or request label Mar 4, 2022
@CodeSmell CodeSmell added this to the 0.3.2 milestone Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

1 participant