none
Multiple REF fields in X12-856 EDI schema . RRS feed

  • Question

  •  

    I want to have the following in the outgoing 856 schema : two REF fields populated from 2 different fileds from source xml .

     

    REF*BM~

    REF*LP~


    supplierParty  maps to   REF01 in 1st REF node

    billoflading maps to REF01 in 2nd REF node

     

    I need two seperate REF segments for the two fields .  How can I do this?  I tried chaning the schema , but it throwing me run time schema validation error . is there some other mechanism that I can use to make this happen.

     

    Any help would be greatly appreciated!!

     

     

    Regards,

    Monday, April 28, 2008 6:58 PM

Answers

  • Precis,

     

    Your output must meet the X12 requirement of having either the RE02 or the REF03.  In your XSLT above you only output the REF01, which will cause the transaction to fail.

     

     

     

    Monday, May 5, 2008 1:38 PM

All replies

  • Looking at the last post - doing a custom in-line XSLT might be easier for you. Maybe Jim can jump in.

    If you want to edit the schema.

    Right click on the schema and open with the XML editor. Find the instance of the ref you want to split and copy the element. Rename the REF. In the case below, I selected REF_2 from the CLDLoop1. I renamed the duplicated REF_2 to REF_2a.

    like this:
    Code Snippet

            <xs:element minOccurs="0" maxOccurs="200" ref="REF_2">
              <xs:annotation>
                <xs:appinfo>
                  <b:recordInfo structure="delimited" field_order="prefix" tag_name="REF" delimiter_type="inherit_field" count_ignore="no" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" notes="Reference Identification">
                    <b:Rule subjects="X12ConditionDesignatorX_Required" xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
                      <b:Subject name="REF02" />
                      <b:Subject name="REF03" />
                    </b:Rule>
                  </b:recordInfo>
                </xs:appinfo>
              </xs:annotation>
            </xs:element>
              <xs:element minOccurs="0" maxOccurs="200" ref="REF_2a">
                  <xs:annotation>
                      <xs:appinfo>
                          <b:recordInfo structure="delimited" field_order="prefix" tag_name="REF" delimiter_type="inherit_field" count_ignore="no" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" notes="Reference Identification">
                              <b:Rule subjects="X12ConditionDesignatorX_Required" xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
                                  <b:Subject name="REF02" />
                                  <b:Subject name="REF03" />
                              </b:Rule>
                          </b:recordInfo>
                      </xs:appinfo>
                  </xs:annotation>
              </xs:element>


    Then you need to create an element definition for the new REF_2a. Scroll down until you see the element definition for REF_2, and cut and paste again. Here I duplicated the existing REF_2 into REF2a.

    Code Snippet

      <xs:element name="REF_2">
        <xs:annotation>
          <xs:appinfo>
            <b:recordInfo structure="delimited" field_order="prefix" tag_name="REF_2" delimiter_type="inherit_field" count_ignore="no" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" notes="Reference Identification">
              <b:Rule subjects="X12ConditionDesignatorX_Required" xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
                <b:Subject name="REF02" />
                <b:Subject name="REF03" />
              </b:Rule>
            </b:recordInfo>
          </xs:appinfo>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="REF01" type="X12_ID_128">
              <xs:annotation>
                <xs:appinfo>
                  <b:fieldInfo notes="Reference Identification Qualifier_128" />
                </xs:appinfo>
              </xs:annotation>
            </xs:element>
            <xs:element minOccurs="0" name="REF02">
              <xs:annotation>
                <xs:appinfo>
                  <b:fieldInfo notes="Reference Identification_127" />
                </xs:appinfo>
              </xs:annotation>
              <xs:simpleType>
                <xs:restriction base="X12_AN">
                  <xs:minLength value="1" />
                  <xs:maxLength value="30" />
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
            <xs:element minOccurs="0" name="REF03">
              <xs:annotation>
                <xs:appinfo>
                  <b:fieldInfo notes="Description_352" />
                </xs:appinfo>
              </xs:annotation>
              <xs:simpleType>
                <xs:restriction base="X12_AN">
                  <xs:minLength value="1" />
                  <xs:maxLength value="80" />
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
            <xs:element minOccurs="0" ref="C040_2">
              <xs:annotation>
                <xs:appinfo>
                  <b:recordInfo structure="delimited" field_order="infix" delimiter_type="inherit_subfield" count_ignore="yes" sequence_number="4" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" notes="Reference Identifier">
                    <b:Rule subjects="X12ConditionDesignatorX_Paired" xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
                      <b:Subject name="C04003" />
                      <b:Subject name="C04004" />
                    </b:Rule>
                    <b:Rule subjects="X12ConditionDesignatorX_Paired" xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
                      <b:Subject name="C04005" />
                      <b:Subject name="C04006" />
                    </b:Rule>
                  </b:recordInfo>
                </xs:appinfo>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
        <xs:element name="REF_2a">
            <xs:annotation>
                <xs:appinfo>
                    <b:recordInfo structure="delimited" field_order="prefix" tag_name="REF_2" delimiter_type="inherit_field" count_ignore="no" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" notes="Reference Identification">
                        <b:Rule subjects="X12ConditionDesignatorX_Required" xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
                            <b:Subject name="REF02" />
                            <b:Subject name="REF03" />
                        </b:Rule>
                    </b:recordInfo>
                </xs:appinfo>
            </xs:annotation>
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="REF01" type="X12_ID_128">
                        <xs:annotation>
                            <xs:appinfo>
                                <b:fieldInfo notes="Reference Identification Qualifier_128" />
                            </xs:appinfo>
                        </xs:annotation>
                    </xs:element>
                    <xs:element minOccurs="0" name="REF02">
                        <xs:annotation>
                            <xs:appinfo>
                                <b:fieldInfo notes="Reference Identification_127" />
                            </xs:appinfo>
                        </xs:annotation>
                        <xs:simpleType>
                            <xs:restriction base="X12_AN">
                                <xs:minLength value="1" />
                                <xs:maxLength value="30" />
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:element>
                    <xs:element minOccurs="0" name="REF03">
                        <xs:annotation>
                            <xs:appinfo>
                                <b:fieldInfo notes="Description_352" />
                            </xs:appinfo>
                        </xs:annotation>
                        <xs:simpleType>
                            <xs:restriction base="X12_AN">
                                <xs:minLength value="1" />
                                <xs:maxLength value="80" />
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:element>
                    <xs:element minOccurs="0" ref="C040_2">
                        <xs:annotation>
                            <xs:appinfo>
                                <b:recordInfo structure="delimited" field_order="infix" delimiter_type="inherit_subfield" count_ignore="yes" sequence_number="4" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" notes="Reference Identifier">
                                    <b:Rule subjects="X12ConditionDesignatorX_Paired" xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
                                        <b:Subject name="C04003" />
                                        <b:Subject name="C04004" />
                                    </b:Rule>
                                    <b:Rule subjects="X12ConditionDesignatorX_Paired" xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
                                        <b:Subject name="C04005" />
                                        <b:Subject name="C04006" />
                                    </b:Rule>
                                </b:recordInfo>
                            </xs:appinfo>
                        </xs:annotation>
                    </xs:element>
                </xs:sequence>
            </xs:complexType>
        </xs:element>


    Instead of REF_2a - you could call the record something more intelligent. (ie. REF_billoflading)

    You could also add an enumeration restriction on REF01 so that only the value you wish is legal.

    If you are going to use the new schema for disassembly. You also need to add trigger_fields so the disassembler knows which XML element holds which REF segment. If that is the case, let me know.

    Tuesday, April 29, 2008 1:36 PM
  •  

    It is not necessary to modify the schema to do mapping.  There are several methods you could use to get the two REF segments including some using only functoids and links.  Those are dependent on how your source data is structured, though.  The easiest way would be to use an XSLT template.  Here is the one I posted for outputting two N3 segments:

     

    <!-- This template outputs one N3 if data present -->

    <xsl:template name="N3_1">
     <xslaram name="adx1" />
     <xslaram name="adx2" />

     <xslaram name="adx3" />
     
     <xsl:if test="$adx1 != '' ">
      <xsl:element name="ns0:N3_Address_Information_S43">
       <xsl:element name="ns0:_166_Address_Information_E1"><xsl:value-of select="$adx1"/></xsl:element>
        <xsl:if test="$adx2 != '' ">
         <xsl:element name="ns0:_166_Address_Information_E2"><xsl:value-of select="$adx2"/></xsl:element>
        </xsl:if>
      </xsl:element>
     </xsl:if>

     <xsl:if test="$adx3!= '' ">
      <xsl:element name="ns0:N3_Address_Information_S43">
       <xsl:element name="ns0:_166_Address_Information_E1"><xsl:value-of select="$adx3"/></xsl:element>
      </xsl:element>
     </xsl:if>

    </xsl:template>

     

    This will work just as well for your two REF segments.  Of course you will have to change the code to match the REF rather than the N3, but that should not be difficult.  If you have a problem with this template, email me jim@sspsi.com.

     

    Tuesday, April 29, 2008 2:20 PM
  • Hi Jim ,

     

    I have  created the below XSLT  to create a REF node . Is that valid . I want the supplierPartyId into that REF --- REF01 field . I am getting error saying " Unable to read the stream produced by pipeline " serilization error .

     

    I am new to xslt .... please help if there is any error with the below XSLT that I have created for REF node .

     

    <xsl:template name="REF_1">
     <xslStick out tonguearam name="PartyId" />
     

     <xsl:if test="PartyId != '' ">
      <xsl:element name="ns0:REF_REF01">
       <xsl:value-of select="PartyId"/></xsl:element>
      </xsl:element>
     </xsl:if>

    </xsl:template>

     

    Thanks
    Wednesday, April 30, 2008 2:29 PM
  • Precis,

     

    Your output must meet the X12 requirement of having either the RE02 or the REF03.  In your XSLT above you only output the REF01, which will cause the transaction to fail.

     

     

     

    Monday, May 5, 2008 1:38 PM
  • Did you get this issue resolved?  If not, try this:

     

    <xsl:template name="REF_1">
     <xslStick out tonguearam name="PartyCode" />
     <xslStick out tonguearam name="PartyId" />
     

     <xsl:if test="PartyId != '' ">
      <xsl:element name="ns0:REF_REF01">
       <xsl:value-of select="PartyCode"/></xsl:element>
      </xsl:element>
      <xsl:element name="ns0:REF_REF02">
       <xsl:value-of select="PartyID"/></xsl:element>
      </xsl:element>
    </xsl:if>

    </xsl:template>

     

    Per your initial question, the REF01 would contain either "BM" or "LP".  Your actual value would go in the REF02.  Remember that the REF01 is restricted to the values in a code list. 

     

    If you are still having a problem, email me direct at jim@sspsi.com

    Monday, May 19, 2008 2:35 PM