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

Question for path #243

Open
AlittleBird2023 opened this issue Mar 23, 2023 · 3 comments
Open

Question for path #243

AlittleBird2023 opened this issue Mar 23, 2023 · 3 comments
Labels

Comments

@AlittleBird2023
Copy link

Hello,

I am a newbie to Indice.EDI. Could anyone please help explain to me what's the difference in the path between "DTM/0" and "DTM/0/0"? How to use the "path" well? Sorry for my stupid question!

@cleftheris
Copy link
Contributor

Hi @AlittleBird2023 and thanks for your interest in EDI.Net.

The path is interpreted contextually. This means that when paired with an EdiElement attribute it is interpreted as one level path and on an EdiValue attribute it is always treated as a two level path (element index, component index). That said, when the zero index is omitted it is considered implied so in an EdiValue

Check these examples for the EdiValue

  • DTM == DTM/0 == DTM/0/0
  • DTM/1 == DTM/1/0

Accordingly for an Element

  • DTM == DTM/0

Hope this helps.

C.

@AlittleBird2023
Copy link
Author

Thanks @cleftheris for your quick reponse!

So, in the following example:

    [EdiSegment, EdiSegmentGroup("PO1", SequenceEnd = "CTT")]
    public class OrderDetail
    {
        ...

        [EdiCondition("018", Path = "DTM/0/0")]
        public DTM AvailableFromDate { get; set; }

        [EdiCondition("067", Path = "DTM/0/0")]
        public DTM ArrivalDate  { get; set; }

        [EdiCondition("002", Path = "DTM/0/0")]
        public DTM DeliveryRequestedDate { get; set; }

        [EdiCondition("038", Path = "DTM/0/0")]
        public DTM ShipNoLaterDate { get; set; }

        ...
    }

    [EdiSegment, EdiPath("DTM")]
    public class DTM
    {
        [EdiValue(Path = "DTM/0", Description = "DTM01 - Date/Time Qualifier")]
        public string DateTimeQualifier { get; set; }

        [EdiValue("9(8)", Path = "DTM/1", Format = "yyyyMMdd", Description = "DTM02 - Date format =CCYYMMDD")]
        public DateTime Date { get; set; }
    }

The condition path "DTM/0/0" in class OrderDetail can be rewritten to "DTM/0" because there are no components in element DateTimeQualifier, right?

@cleftheris
Copy link
Contributor

There are always components involved on the value level.
For example the following line represents a DTM segment with one element and inside of that one component
DTM+137
While this has one element and 3 components.
DTM+137:20060619165058:203

The component it there regardless of the delimiter.
For the condition attribute always express the full path for the value - don't use the short versions.

A side note do prefer the explicit EdiSegmentGroup declaration over the SequenceEnd. The former is the one that you have to declare all direct desendant segment names while the latter will only get you so far on simple usecases. Checkout examples in the tests project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants