EDI.Net
EDI.Net copied to clipboard
Assistance needed with Loop
I am trying to parse another 820, but I am unable to get to the IT1 segment. How would you structure the classes according to this screenshot of the loops in the documents?
This is what I have:
[EdiSegment, EdiPath("ADX")]
public class ADX
{
}
[EdiSegment, EdiPath("RMR")]
public class RMR
{
}
[EdiSegment, EdiPath("REF")]
public class REF
{
}
[EdiSegment, EdiPath("NTE")]
public class NTE
{
}
[EdiSegment, EdiPath("IT1")]
public class IT1
{
[EdiValue("X(15)", Path = "IT1/6")]
public string PONumber { get; set; }
}
[EdiSegmentGroup("ADX", "NTE")]
public class Adjustment : ADX
{
public List<NTE> Notes { get; set; }
}
[EdiSegmentGroup("RMR", "REF", "DTM", "IT1")]
public class RemittanceAdvice : IT1
{
public List<REF> REF { get; set; }
public DateTimePeriod Date { get; set; }
}
[EdiSegment, EdiPath("DTM")]
public class DateTimePeriod
{
}
It kinda works, but getting to IT1 segment is not accurate.
This is what the details look like. If you notice, one of the IT1 differs.
Hi I am not familiar with this segment. But you could use a condition attribute to bind to a different class when this type of IT1 occures
I considered that option, however, the segment identifier (second element) is not present. My main question though, looking at the loops in the TP docs, how would you have structured your classes?
I don't have the time to make an test on this so if you make a pull request with your model and sample transmission along with a test, I may find the time to comment or improve it.
As far as the condition attribute is concerned you can use it to discriminate with any value inside the segment even the absense of a value is enough to work in your case (the empty string ""). Take a look here https://github.com/indice-co/EDI.Net/blob/master/test/indice.Edi.Tests/Models/EdiFact_ORDRSP_Conditions.cs