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

EdiSegmentGroup not serialised. #40

Closed
Nekeniehl opened this issue Apr 10, 2017 · 2 comments
Closed

EdiSegmentGroup not serialised. #40

Nekeniehl opened this issue Apr 10, 2017 · 2 comments

Comments

@Nekeniehl
Copy link
Contributor

Nekeniehl commented Apr 10, 2017

First at all I have to say sorry for the bunch of tickets I'm opening lately.

The problem this time is when you have two EdiSegmentGroup in the Message Level, it only parses one:
I have EdiSegmentGroup for RFF and another EdiSegmentGroup for NAD. The problem seems to be in the TryCreateContainer, when the reader reach the NAD point, the stack contains 3 EdiStructure, the EdiSegmentGroup for the RFF, the message and the interchange. The first conditional is true but when reaches the loop for //Nested hierarchy the conditional if (!level.IsGroup) is false on the Message level (where the other EdiSegmentGroup for NAD is) and simply goes out without finding the property.
I don't know if this can help you to know the problem, but testing, and playing around while debugging I jump to the "else" directly from the first conditional and it works, parsing both EdiSegmentGroups.

Thanks once again.

//FIRST CONDITIONAL
if (newContainer == EdiStructureType.SegmentGroup &&
    (stack.Peek().Container >= EdiStructureType.SegmentGroup)) {
    // strict hierarchy
    while (stack.Peek().Container > newContainer) {
        var previous = stack.Pop(); // close this level
    }
    // nested hierarchy
    foreach (var level in stack) {
        if (!level.IsGroup)
            continue; //THIS IS FALSE FOR @MESSAGE
        var groupStart = level.Descriptor.SegmentGroupInfo.StartInternal;
        var sequenceEnd = level.Descriptor.SegmentGroupInfo.SequenceEndInternal;
        if (reader.Value.Equals(groupStart.Segment)) {
            level.Close(); // Close this level
            index = level.Index + 1;
            break;
        } else if (reader.Value.Equals(sequenceEnd.Segment)) {
            level.Close(); // Close this level
            break;
        }
    }
    if (stack.Any(s => s.IsClosed)) {
        var previous = stack.Peek();
        do
            previous = stack.Pop();
        while (!previous.IsClosed);
    }
} else {
     //IF I JUMP DIRECTLY HERE ON THE NAD IT PARSED CORRECTLY
    // strict hierarchy
    while (stack.Peek().Container >= newContainer) {
        var previous = stack.Pop(); // close this level
        if (previous.Container == newContainer)
            index = previous.Index + 1; // seed collection index
    }
}
@cleftheris
Copy link
Contributor

Hi @Nekeniehl, and don't worry about the tickets. I always try to respond as my time permits me todo.

How do you escape your segment groups. Are you using the SequenceEnd member on the attribute correctly? SequenceEnd is meant to be used (when needed) as the segment that breaks the sequence; it is the first segment not taking part in the sequence.

Can you point me to the EDI fragment and classes at your pull request.

Thanks

@Nekeniehl
Copy link
Contributor Author

Nekeniehl commented Apr 11, 2017

Hi, thanks, that was the problem, decorated the RFF as follows has solve it:

[EdiSegmentGroup("RFF", SequenceEnd = "AJT")]
[EdiSegment]
[EdiPath("RFF")]
public class RFF

I will close the ticket and cancel the pull request, if I don't find any more troubles today I will pull the completely POCO for ORDRSP in a while.

Thanks!

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