Giter Club home page Giter Club logo

Comments (6)

hod-github avatar hod-github commented on August 13, 2024 1

Greatly appreciate it!! Thanks a bunch.

from staedi.

MikeEdgar avatar MikeEdgar commented on August 13, 2024

@hod-github - version 1.10.0 has been released with this change included. The reference returned by the EDIStreamReader will vary depending on the position of the reader within the input EDI stream.

EDIReference reference = reader.getSchemaTypeReference();
EDIType type = reference.getReferencedType();
String title = type.getTitle(); // "title" attribute from schema
String description = type.getDescription(); // "description" element text from schema

from staedi.

hod-github avatar hod-github commented on August 13, 2024

Wow, that was fast!! Do you mind adding a quick snapshot of how it looks like in the Schema xml? Just to I'm sure I'm going to use it correctly.

from staedi.

MikeEdgar avatar MikeEdgar commented on August 13, 2024

@hod-github - you would set the title similar to the elements in the common X12 control schema:

https://github.com/xlate/staedi/blob/master/src/main/resources/X12/common.xml

Just to be clear, this addresses only the first item in the original issue description. The second point about 1000B vs. L0001 is already covered. You just need to set the code attributes on your loops accordingly.

from staedi.

hod-github avatar hod-github commented on August 13, 2024

Hi @MikeEdgar , while trying to use the new functionality I realized I probably have a gap in my understanding. So wanted to ask this quick question to see where I'm going wrong...
The description and title of an element might change depending on their position of it in the file, for example if I have this (simplified) file:
ISA*01*...
GS*HC*...
ST*837*...
BHT*0019*...
NM1*412SAMPLE INC46*496103
PER*IC*...
NM1*402PPO BLUE
46*54771
.
.

You can see that I have two NM1 and both are the exact same structure, yet each one represents a different meaning, the first NM1 is "Submitter Name" while the second if the "Receiver name", how do I use the schema to associate a different title for each one so when I'm in line 5 the getTitle() will return "Submitter Name" and in line 7 "Receiver name"?

from staedi.

MikeEdgar avatar MikeEdgar commented on August 13, 2024

@hod-github - consider the following "standard" layout (everything after loop 1000 is omitted to make the point).

  <transaction>
    <sequence>
      <segment type="BHT" minOccurs="1"/>
      <segment type="REF" maxOccurs="3"/>
      <loop code="1000" maxOccurs="10">
        <sequence>
          <segment type="NM1"/>
          <segment type="N2" maxOccurs="2"/>
          <segment type="N3" maxOccurs="2"/>
          <segment type="N4"/>
          <segment type="REF" maxOccurs="2"/>
          <segment type="PER" maxOccurs="2"/>
        </sequence>
      </loop>
      ...
    </sequence>
  </transaction>

While the standard defines the generic layout of the transaction, the implementation defines what multiple occurrences of a loop should look like. For example, loop 1000A and 1000B are both occurrences of the standard loop 1000, with a reduction in the segments and elements that can be used. This roughly describes those two loops in the 837, again with the remainder of the implementation after loop 1000 omitted. Note the discriminator attribute which names the element within the loop's first segment that is used to determine which of the occurrences to select for validation. In the case of loop 1000, the NM101 is either 41 or 40 (identified in the element enumeration in position 1). Segments that are not to be used at left out of the implementation.

  <implementation>
    <sequence>
      <segment type="BHT" />
      <loop code="1000A" type="1000" discriminator="1">
        <sequence>
          <segment type="NM1" title="Submitter Name">
            <sequence>
              <element position="1">
                    <enumeration>
                      <value>41</value>
                    </enumeration>
              </element>
              <element position="2"/>
              <element position="3"/>
              <element position="4"/>
              <element position="5"/>
              <element position="8"/>
              <element position="9"/>
            </sequence>
          <segment>
          <segment type="PER" />
        </sequence>
      </loop>
      <loop code="1000B" type="1000" discriminator="1">
        <sequence>
          <segment type="NM1" title="Receiver Name">
            <sequence>
              <element position="1">
                    <enumeration>
                      <value>40</value>
                    </enumeration>
              </element>
              <element position="2"/>
              <element position="3"/>
              <element position="8"/>
              <element position="9"/>
            </sequence>
          <segment>
        </sequence>
      </loop>
    </sequence>
  </implementation>

from staedi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.