indice-co / indice-co/EDI.Net

Repeating Group of segments

Open
#118 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C#
Stars
490
Forks
173
PR merge metrics
No merged PRs in 30d

Description

I have a repeating group of segments that I am not sure how to create the classes for.

```
ISA*
GS*
ST*
N7*
GA*
N7*
GA*
SE*
GE*
IEA*
```
I can have an arbitrary number of N7 and GA segments and each N7 is related to the GA below it so I would like to put each N7/GA group into the same containing class. I have tested my classes out separately (just an N7 and then just a GA) and they work fine individually, so I think it is the way I am attempting to group them together.

```csharp
[EdiSegment, EdiPath("N7")]
public class MyN7
{
// my fields
}

[EdiSegment, EdiPath("GA")]
public class MyGa
{
// my fields
}

[EdiSegmentGroup("N7", "GA")]
public class MyGroup
{
public MyN7 theN7 {get;set;}
public MyGa theGa {get;set;}
}

[EdiMessage]
public class TransactionSetHeader
{
// my ST stuff
public List TheN7AndGaGroups {get;set;}
// my SE stuff
}
```
There are no parse errors but while the GA segments will all parse fine, all of the N7 segments are always null. If I change the TransactionSetHeader to just have 1 instance of an N7 and a GA and modify my input file to only have 1 N7/GA pair, it will parse happily.

I have tried to put all of the N7 / GA fields into the same class (parse failure - it couldn't find a GA on the stack) and several other variants.

If I use this and serialize it to a file (instead of reading it in), it does serialize as expected.

Any suggestions?

Thanks

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with EDI.Net deserialization of the EdiSegmentGroup containing MyN7 and MyGa, using the repeated N7/GA sample and the single-pair variant described in the issue. Compare how repeated groups are populated with the serialization behavior; done means every N7/GA pair populates one MyGroup without breaking the existing single-pair case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.