Biztalk Schema for varying role for a given partner

Home Page Forums BizTalk 2004 – BizTalk 2010 Biztalk Schema for varying role for a given partner

Viewing 1 reply thread
  • Author
    Posts
    • #26120

      Background:
      I have Biztalk 2010, SQL2008R2 backend. I have flat file source to Biztalk
      which looks as follows. Field delimited “I” and Record Delimited “<CR><LF>”.

      ENV|prt198623083932|…

      PAR|TGL|01|104|D05|Partner
      Name 1….

      ROL|TGL|01|104|Role1 …

      ROL|TGL|04|104|Role2 …

      PAR|TGL|01|D104001|D05|Partner
      2 …

      ROL|TGL|01|D104001|Role 1

      PAR|TGL|01|104|D052|Partner
      Name 3….

      ROL|TGL|01|1042|Role1 …

      ROL|TGL|04|1042|Role2 …

      ROL|TGL|01|1042|Role1 …

      ROL|TGL|04|1042|Role2 …

       

      One ENV
      header, PAR with Varying Roles. Roles are at minimum 1 and maximum are unbounded.

       

      Regardless
      of what I do with Min, Max, Group Sequence etc. the schema does not recognizes
      the varying partner “ROL”. Appreciate your help.

       

      I have used
      Biztalk standard tools and created a schema to import the records. It is as
      follows. To keep it simple, I keep the details standard information out for now
      and focus on the Partner and Role Sequence Group schema.

       

      Thanks,
      Toraj – [email protected]

       


      <xs:sequence minOccurs=”1″ maxOccurs=”unbounded”>


      <xs:annotation>


      <xs:appinfo>

        <groupInfo
      xmlns=”http://schemas.microsoft.com/BizTalk/2003&#8243;
      sequence_number=”2″ />

        </xs:appinfo>

        </xs:annotation>


      <xs:element minOccurs=”0″ maxOccurs=”unbounded”
      name=”WraperPartnerRole”>


      <xs:annotation>


      <xs:appinfo>

        <b:recordInfo
      structure=”delimited”
      preserve_delimiter_for_empty_data=”true”
      suppress_trailing_delimiters=”false” sequence_number=”1″
      />

        </xs:appinfo>

        </xs:annotation>


      <xs:complexType>

      – <xs:sequence>


      <xs:annotation>


      <xs:appinfo>

        <b:groupInfo sequence_number=”0″
      />

        </xs:appinfo>

        </xs:annotation>


      <xs:element maxOccurs=”unbounded” name=”Partner”>


      <xs:annotation>


      <xs:appinfo>

        <b:recordInfo tag_name=”PAR”
      structure=”delimited” child_delimiter_type=”char”
      child_delimiter=”|” child_order=”prefix”
      preserve_delimiter_for_empty_data=”true”
      suppress_trailing_delimiters=”false” notes=”I) Each message file
      must have at least one “Patner” segment. II) Each message file can
      contain multiple “Patner” Segments, but only one per each
      “env”.” sequence_number=”1″ />

        </xs:appinfo>

        </xs:annotation>


      <xs:complexType>


      <xs:sequence>


      <xs:annotation>


      <xs:appinfo>

        <groupInfo sequence_number=”0″
      xmlns=”http://schemas.microsoft.com/BizTalk/2003&#8243; />

        </xs:appinfo>

        </xs:annotation>


      <xs:element name=”Client” type=”xs:string”>


      <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”1″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>


      <xs:element name=”PartnerType” type=”xs:string”>


      <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”2″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>


      <xs:element name=”PartnerReference” type=”xs:string”>


      <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”3″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>

      …….


      <xs:element name=”UserName” type=”xs:string”>


      <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”26″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>


      <xs:element name=”Date” type=”xs:string”>


      <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”27″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>


      <xs:element name=”Time” type=”xs:string”>


      <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”28″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>

        </xs:sequence>

        </xs:complexType>

        </xs:element>


      <xs:element maxOccurs=”unbounded” name=”Role”>


      <xs:annotation>


      <xs:appinfo>

        <b:recordInfo tag_name=”ROL”
      structure=”delimited” child_delimiter_type=”char”
      child_delimiter=”|” child_order=”prefix”
      preserve_delimiter_for_empty_data=”true”
      suppress_trailing_delimiters=”false” notes=”Each
      “Partner” segment will have one or more “Role” segment.”
      sequence_number=”2″ />

        </xs:appinfo>

        </xs:annotation>


      <xs:complexType>


      <xs:sequence>


      <xs:annotation>


      <xs:appinfo>

        <groupInfo sequence_number=”0″
      xmlns=”http://schemas.microsoft.com/BizTalk/2003&#8243; />

        </xs:appinfo>

        </xs:annotation>


      <xs:element name=”Client” type=”xs:string”>


      <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”1″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>


      <xs:element name=”PartnerRoleType” type=”xs:string”>

      – <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”2″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>

      ….


      <xs:element name=”Date” type=”xs:string”>


      <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”6″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>


      <xs:element name=”Time” type=”xs:string”>


      <xs:annotation>


      <xs:appinfo>

        <b:fieldInfo
      justification=”left” sequence_number=”7″ />

        </xs:appinfo>

        </xs:annotation>

        </xs:element>

        </xs:sequence>

        </xs:complexType>

        </xs:element>

        </xs:sequence>

        </xs:complexType>

        </xs:element>

        </xs:sequence>

       

       

    • #26144

      Hi:

      After working at this for a while, there is no easy solution to it than good old XSLT Loop inside a loop. Here what I finally did and working in production.

      Cheers, Toraj

      <xsl:for-each select="../Partner">

      <ns0:Record-XMNREF0 xmlns:ns0="urn:ProcessPartner">

      <ns0:Col-CLIENT>

       <xsl:value-of select="Client/text()" />

      </ns0:Col-CLIENT>

      <ns0:Col-NRTYPE>

       <xsl:value-of select="PartnerType/text()" />

      </ns0:Col-NRTYPE>

      <ns0:Col-NRNREF>

       <xsl:value-of select="PartnerReference/text()" />

      </ns0:Col-NRNREF>

      <ns0:Col-NRPGRP>

       <xsl:value-of select="PartnerGroup/text()" />

      </ns0:Col-NRPGRP>

      <ns0:Col-NRNAME>

       <xsl:value-of select="PartnerName/text()" />

      </ns0:Col-NRNAME>

      <ns0:Col-NRADR1>

       <xsl:value-of select="AddressLine1/text()" />

      </ns0:Col-NRADR1>

      <ns0:Col-NRDATE>

       <xsl:value-of select="Date/text()" />

      </ns0:Col-NRDATE>

      <ns0:Col-NRTIME>

       <xsl:value-of select="substring(Time, 1, 4)" />

      </ns0:Col-NRTIME>

      <!– Patner Reference –>

      <xsl:variable name ="prtRef" select="PartnerReference/text()"/>

      <xsl:for-each select="../Role">

      <!– Role Reference –>

      <xsl:variable name="refRef" select="string(Reference)"/>

      <xsl:if test="($refRef = $prtRef)">

      <!–Put the Role information inside the current Partner node only if Role belong to current Partner–>

      <ns0:Record-XMNIRL0 xmlns:ns0="urn:ProcessPartner">

      <ns0:Col-CLIENT>

      <xsl:value-of select="Client/text()" />

      </ns0:Col-CLIENT>

      <ns0:Col-NITYPE>

      <xsl:value-of select="PartnerRoleType/text()" />

      </ns0:Col-NITYPE>

      <ns0:Col-NINREF>

      <xsl:value-of select="Reference/text()" />

      </ns0:Col-NINREF>

      ……

      <ns0:Col-NIDATE>

      <xsl:value-of select="Date/text()" />

      </ns0:Col-NIDATE>

      <ns0:Col-NITIME>

      <xsl:value-of select="substring(Time, 1, 4)" />

      </ns0:Col-NITIME>

      </ns0:Record-XMNIRL0>

      </xsl:if>

      </xsl:for-each>

      </ns0:Record-XMNREF0>

      </xsl:for-each>

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.