none
Handling multiple N3 segments in outgoing X12 850 RRS feed

  • Question

  •  

    I am new to BizTalk and am trying to figure out how to acomplish what I thought was a simple task.  I need to construct a purchase order that has 3 address fields.  I am using BizTalk 2006 R2 and have found creating the EDI trasnactions quite easy except for this.  My requirement is to pass address 1, 2 and 3.  The N3 segment has 2 elements for address 1 and 2 easily enough.  I see that the schema for the 850 indicates that the N3 segment can occurr 0 to 2 times.  In my mapping of my data to the 850 schema, how do I map my address 3 to a NEW N3 segment?  In our old EDI process we simply created a new N3 segment in the outgoing file and filled the new N3 segment's element N301 with my address 3 data.  How can I accomplish this with BizTalk?  I am sorry if this is not very clear, but let me supply an illustration:

     

    I want to have the following in the outgoing 850:


    N3*123 Main St.*Suite 123~
    N3*Attn:Fred~

     

     

    address1   maps to   N301

    address2   maps to   N302

     

    My address3 line (the Attn: Fred) needs to be in a separate N3 segment.  How can I do this?  Is there a change that I need to make to the 850 schema or is there some other mechanism that I can use to make this happen.

     

    Any help would be greatly appreciated!!

     

     

    Regards,

    Mirko

     

    Friday, April 25, 2008 6:51 PM

Answers

  • Mirko,

     

    The quickest and simplest way to handle these situations is with an XSLT script.

     

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

    <xsl:template name="N3_1">
     <xslStick out tonguearam name="adx1" />
     <xslStick out tonguearam name="adx2" />

     <xslStick out tonguearam 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>

     

    Here is a sample script that would be used as inline xslt to output the N3.  I just did it from scratch so check it closely.  Of course you would have to change the node names to match your schema if necessary.

     

    Connect the output of the scripting functoid to the N3 node in the schema.

     

    Hope this helps,

     

    Sunday, April 27, 2008 8:11 PM

All replies

  • I can think of a couple ways to tackle this... one in the map using a global variable to track the iteration of N3 you were on - and mapping from each source conditional on that value.

    I think the easier way would be to modify the schema. Add another N3 segment, use a unique XML name, but keep the EDI properties the same.(might be a notepad event for you) Then map the source data to the properly named N3 segment.
    Friday, April 25, 2008 8:53 PM
  • Mirko,

     

    The quickest and simplest way to handle these situations is with an XSLT script.

     

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

    <xsl:template name="N3_1">
     <xslStick out tonguearam name="adx1" />
     <xslStick out tonguearam name="adx2" />

     <xslStick out tonguearam 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>

     

    Here is a sample script that would be used as inline xslt to output the N3.  I just did it from scratch so check it closely.  Of course you would have to change the node names to match your schema if necessary.

     

    Connect the output of the scripting functoid to the N3 node in the schema.

     

    Hope this helps,

     

    Sunday, April 27, 2008 8:11 PM
  • Thanks for the help!  I will try this approach and let you know how it goes. 

     

    Monday, April 28, 2008 12:00 PM
  • Thanks Jim, that did it for me.  I apperciate the help!

     

     JimDawson wrote:

    Mirko,

     

    The quickest and simplest way to handle these situations is with an XSLT script.

     

    <!-- 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>

     

    Here is a sample script that would be used as inline xslt to output the N3.  I just did it from scratch so check it closely.  Of course you would have to change the node names to match your schema if necessary.

     

    Connect the output of the scripting functoid to the N3 node in the schema.

     

    Hope this helps,

     

    Monday, April 28, 2008 1:21 PM
  • Hi ,

     

    I had the similar issue but with REF node in X12 .

     

    I want to have another REF node to populate the value from differnt destination node .

     

    REF*BM

    REF*LP

     

     

    one REF is populate from billoflading and the other REF is populated from supply party .

     

    I am not sure on how I can create xslt for this .

     

    Please help.

     

    Thanks.

    Monday, April 28, 2008 6:33 PM