Mapping

Viewing 1 reply thread
  • Author
    Posts
    • #14435

      Hi All,
      May be some body knows answer for my question.
      I have a positional flat file, which has certain amount of records.
      Each record has invoice number and details for this invoice.

      I have created sours schema, which get this flat file and transform it to XML format.
      And I have created destination schema.

      So, the main question is:
      When I use a mapping, I have to compare invoices with which other before I’ll
      map them to destination schema.
      I could not find mechanism which allows me to navigate between records.
      All functoids , if I understand properly, work only with one record at a time.
      So, I can not, let say from record 1 to record 2,3, and so on.

      If some body had a situation like that please help me.

      My email is [email protected]

      Thanks a lot.
      Leon.

    • #14436

      I believe what you are trying to do is group output records using the invoice number.
      Here is one way of doing this using custom Xslt.

      [code:1:fba2adcd33]<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
      xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\"
      exclude-result-prefixes=\"msxsl s0\" version=\"1.0\"
      xmlns:s0=\"input:namedspace\"
      xmlns:ns0=\"output:namespace\">
      <xsl:output omit-xml-declaration=\"yes\" version=\"1.0\" method=\"xml\" />
      <xsl:key name=\"invoicekey\" match=\"/s0:invoicerecords/record\" use=\"invoicenumber\"/>
      <xsl:template match=\"/\">
      <xsl:apply-templates select=\"/s0:invoicerecords\" />
      </xsl:template>
      <xsl:template match=\"/s0:invoicerecords\">
      <ns0:Invoices>
      <xsl:for-each select=\"record\">
      <xsl:variable name=\"group\" select=\"key(’invoicekey’, invoicenumber)\"/>
      <xsl:if test=\"generate-id($group[1]) = generate-id()\">
      <Invoice>
      <Header>
      <xsl:element name=\"number\">
      <xsl:value-of select=\"invoicenumber\" />
      </xsl:element>
      </Header>
      <xsl:for-each select=\"$group\">
      <Line>
      <xsl:element name=\"lineNumber\">
      <xsl:value-of select=\"lineNumber\" />
      </xsl:element>
      <xsl:element name=\"desc\">
      <xsl:value-of select=\"description\" />
      </xsl:element>
      </Line>
      </xsl:for-each>
      </Invoice>
      </xsl:if>
      </xsl:for-each>
      </ns0:Invoices>
      </xsl:template>
      </xsl:stylesheet> [/code:1:fba2adcd33]

      To implement this:
      1. Save this Xslt into a file
      2. Edit the namespaces and node names to match your schemas
      3. Add this file to your project
      4. Create a new map
      5. Specify the input and output schema
      6. Click on map grid
      7. Specify Custom Xslt file name property.
      8. Test map

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