indice-co / indice-co/EDI.Net

How do you parse a subelement?

Open
#220 1 comment 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 some EDI that I'd like to parse that looks like this:
```
REF*WS*CHBOH*0*QO>358>AD>20220608~
```
In other words, `358`, `AD`, and `20220608` are all subelements of the REF04 element. Is there a way for me to get at the data?

I currently have REF defined as this:
```
[EdiSegment, EdiPath("REF")]
public class REF
{
[EdiValue(Path = "REF/0")]
public string ReferenceIdentificationQualifier { get; set; }

[EdiValue(Path = "REF/1")]
public string ReferenceIdentification { get; set; }

[EdiValue(Path = "REF/2")]
public string Description { get; set; }

[EdiValue(Path = "REF/3")]
public string RefIdentifier { get; set; }
}
```
When I parse and print out the data, I can see `REF*WS*CHBOH*0*QO`, but I can't get to the `>358>AD>20220608`.

Is there a way to get it to either drop the subelements into a property, or just eagerly grab everything? I'm perfectly fine parsing it after the majority of the EDI has been handled.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the REF class uses EdiSegment, EdiPath, and EdiValue, especially the REF/3 path, then inspect how the parser handles the `>` characters in the sample segment. Done means the values 358, AD, and 20220608 can be accessed from REF04, or the supported limitation and workaround are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.