indice-co / indice-co/EDI.Net

Separating groups with different segments

Open
#145 9 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

![TP_REFERENCE](https://user-images.githubusercontent.com/57195982/70558126-452bfb80-1b52-11ea-86d3-1aab3085d434.jpg)
I am trying to parse 820. Some of them have ADX before the RMR (According to the TP reference, this ADX loop contains adjustment items which are not netted to an RMR segment in this transaction set) while some of the ADX are part of the RMR (This ADX loop can only contain adjustment for the immediately preceding RMR segment and affects the amount RMR04. If this adjustment amount is not netted to the immediately preceding RMR, use the outer ADX loop (position 080).

## SAMPLE ONE

```
ISA*00* *00* *08*TPTESTUS00 *ZZ*TESTCOMP *191029*1900*:*00501*820101047*0*P*>
GS*RA*TPTESTUS00*TESTCOMP*20191029*1900*820101047*X*005010
ST*820*101053
BPR*I*21298.97*C*CHK************20191029*VEN
TRN*3*4529952
CUR*PR*USD
N1*PR*MART INC.*UL*1238742000008
N1*PE*Test Company, LLC
REF*IA*446963
ENT*1
RMR*IV*26801*PO*4408.75*4650.41*97.9
REF*DP*00040
REF*MR*0033
REF*PO*1016071221
REF*MC*858008293
REF*19*07
REF*ST*0078742031897
DTM*097*20190904
ADX*-143.76*59*CM*26801
REF*6O*022
REF*MC*000000025
RMR*IV*26927*PO*4653.84*4753.92*100.08
REF*DP*00040
REF*MR*0033
REF*PO*3016440142
REF*MC*884600831
REF*19*07
REF*ST*0078742029733
DTM*097*20190910
SE*28*101067
GE*1*820101061
IEA*1*820101061
```

## SAMPLE TWO

```
ISA*00* *00* *08*TPTESTUS00 *ZZ*TESTCOMP *191029*1900*:*00501*820101047*0*P*>
GS*RA*TPTESTUS00*TESTCOMP*20191029*1900*820101047*X*005010
ST*820*101053
BPR*I*21298.97*C*CHK************20191029*VEN
TRN*3*4529952
CUR*PR*USD
N1*PR*MART INC.*UL*1238742000008
N1*PE*Test Company, LLC
REF*IA*446963
ENT*1
ADX*143.76*59*DB*25248
REF*ST*0078742028651
REF*6O*022
REF*DP*00040
REF*MR*0033
REF*MC*777777777
ADX*236.04*59*DB*25252
REF*ST*0078742033815
REF*6O*022
REF*DP*00040
REF*MR*0033
REF*MC*777777777
RMR*IV*26565*PO*5121.83*5507.91*115.96
REF*DP*00040
REF*MR*0033
REF*PO*9915981131
REF*MC*796401455
REF*19*07
REF*ST*0078742029917
DTM*097*20190821
ADX*-270.12*59*CM*26565
REF*6O*022
REF*MC*000000025
RMR*IV*26567*PO*4011.69*4097.96*86.27
REF*DP*00040
REF*MR*0020
REF*PO*9958859372
REF*MC*796401457
REF*19*07
REF*ST*0078742030005
DTM*097*20190821
RMR*IV*26635*PO*3329.74*3401.97*72.23
REF*DP*00040
REF*MR*0033
REF*PO*1814609777
REF*MC*831108152
REF*19*07
REF*ST*0078742030999
DTM*097*20190828
SE*48*101067
GE*1*820101061
IEA*1*820101061
```

I am unable to extract and separate the ADX. If I follow the code below, it combines the ADX. I want to list out:

1. ADX (not related to RMR) and their REFS
2. RMR and their REFS
3. ADX related to their preceding RMR and their REFS

```csharp
[EdiMessage]
public class RemittanceDocument
{
#region Header Trailer

[EdiValue("X(3)", Path = "ST/0", Description = "ST01 - Transaction set ID code")]
public string TransactionSetCode { get; set; }

[EdiValue("X(9)", Path = "ST/1", Description = "ST02 - Transaction set control number")]
public string TransactionSetControlNumber { get; set; }

[EdiValue(Path = "SE/0", Description = "SE01 - Number of included segments")]
public int SegmentsCouts { get; set; }

[EdiValue("X(9)", Path = "SE/1", Description = "SE02 - Transaction set control number (same as ST02)")]
public string TrailerTransactionSetControlNumber { get; set; }

#endregion
public List Adjustments { get; set; }

}

[EdiSegmentGroup("ADX")]
public class ADX
{
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the RemittanceDocument and ADX declarations shown in the issue, then trace how EDI.Net maps repeated ADX, RMR, and REF segments into groups. Use the two sample 820 transactions as parsing inputs. Done means non-RMR ADX segments, RMR segments with their REFs, and ADX segments associated with the preceding RMR can be distinguished without combining unrelated adjustments.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.