This project has moved and is read-only. For the latest updates, please go here.

SegmentSpecification Name Property

May 21, 2012 at 2:04 PM


I wondering why the SegmentSpecification doesn't have a Name property, while several of the other specifications (HL, Element, Loop) do?

I'm new to X12 and like having the Name and descriptive comments for IDs and Loops in the XML.  But I noticed some of the Segments didn't have these comments, so I sought to add them.

I was using a 855 Purchase Order acknowledgement file, and was able to add the segment element comments by adding the following to the Ansi-4010Specification.xml.


<!-- 855 Segments -->
  <Segment SegmentId="BAK">
    <Name>Beginning Segment for Purchase Order Acknowledgment</Name>
    <Element Name="353 - Transaction Set Purpose Code" Required="true" Type="ID" MinLength="2" MaxLength="2">
      <Allowed ID="00">New Transaction</Allowed>
      <Allowed ID="05">Replace a previous transaction</Allowed>
    <Element Name="587 - Acknowledgement Type" Required="true" Type="ID" MinLength="2" MaxLength="2">
      <Allowed ID="AT">Accept Entire Purchase Order as is.  No changes.</Allowed>
      <Allowed ID="AC">Acknowledge - With Detail and Change.</Allowed>
      <Allowed ID="AK">Acknowledge - No Detail or Change.</Allowed>
      <Allowed ID="RJ">Rejected - No Detail.</Allowed>
      <Allowed ID="RD">Rejected - Detail.</Allowed>
    <Element Name="324 - Purchase Order Number" Required="true" Type="AN" MinLength="1" MaxLength="22"/>
    <Element Name="373 - Date" Required="true" Type="DT" MinLength="8" MaxLength="8"/>


which resulted in the output XML 

        <!--353 - Transaction Set Purpose Code-->
        <!--587 - Acknowledgement Type-->
        <BAK02>AC<!--Acknowledge - With Detail and Change.--></BAK02>
        <!--324 - Purchase Order Number-->
        <!--373 - Date-->

I wanted to take this a step further and add a comment to the BAK segment itself, like this.

<!-- Beginning Segment for Purchase Order Acknowledgment -->

I added Name to the specification xml similar to the Loops and Element, but it didn't work.  Stepping through the code, I found the Segment.WriteXml() function and it doesn't have code to add comments near the beginning of the segment.  I wanted to add code to write the comment, but then discovered the SegmentSpecification had no Name property.

I thought adding a Name property to the segment specification sounded like a larger task and I should consult the development team to see what the proper way to go about adding this comment to the segment beginning.

Best Regards.