Question about mapping with FLATFILE and EDIFACT message using BizTalk 2013 EDI Functionality RRS feed

  • Question

  • Hi,

    We have a situation using BizTalk Mapper (a single map), the source schema is a FLATFILE and the destination schema is a EDIFACT (EFACT_D96A_ORDERS.xsd).

    In the source schema we have a single line in the flatfile like this: 

    Cond. Pagto:  20/10/14 60%  20/11/14 40%

    And the destination schema we have a create a EDIFACT message like this:



    The question is: How to split the date (20/10/14 and 20/11/14 is a date) and two or more DTM segment ?

    Any help will be appreciated!


    Friday, September 18, 2015 5:17 PM

All replies

  • Hi Doug,

    Can you please share what kind of source schema you have created. Seems like you have repeated record in the source flat file 20/10/14 60%  20/11/14 40%. Now on the basis of source repeating record you can manipulate the EDIFACT reocrd DTM by adding an looping functoid. Connect a link from your repeating record from your source schema to the looping functoid and also connect an link from the DTM to the looping record. Make sure your source record and DTM are both marked as UNBOUNDED.

    Please indicate "Mark as Answer" or "Mark as Helpful" if this post has answered the question


    Rahul Madaan

    Friday, September 18, 2015 6:29 PM
  • If the structure is consistent, meaning always two dates and two percentages, then you can treat that line as simple space delimited values.  Meaning, the flat file disassembler can treat the space character as a delimiter just like a comma or pipe.

    If the line is a bit more free form, you would have to create up to 4 C# Functoids, each being smart enough to parse out the specific value it should return.

    Friday, September 18, 2015 7:04 PM
  • Please send the C# Functoid examples for this case?



    Friday, September 18, 2015 8:15 PM
  • Well, we don't really know what your rules are.

    Start with String.Split() and go form there.

    Friday, September 18, 2015 10:26 PM
  • Hi Rahul, thanks for your reply.

    In my source schema I have just one element (Observação field in source schema) with two data (a date and percentual value) in the same field, for example the string: 
    20/10/14 60%  20/11/14 40%
    I don't know how many date and percentual we have, and I need to link two field in the destination schema (date and percentual value).

    Sounds like this (attach file).

     I don't know how to develop the script functoid to split the string and fill the fields in the destination schema.

    Thanks again,


    Tuesday, September 22, 2015 11:20 AM
  • Hi Doug,

    Use Xslt. The solution will use three “Inline XSLT Call Template” scripting functoids

    1. Add the first “Inline XSLT Call Template” scripting functoid to you map.

    The functoid will have no input or output parameters.

     <xsl:template name="DTM" xmlns:ns0="">

        <xsl:param name="DTM_Date"/>

        <xsl:param name="PCD_qualifier"/>












                <xsl:value-of select="$DTM_Date"/>









                <xsl:value-of select="$PCD_qualifier"/>






    2. Add the  second functoid

    The functoid will have no input or output parameters.

      <xsl:template name="tokens">

        <xsl:param name="str" select="."/>

        <xsl:param name="splitString" select="' '"/>


          <xsl:when test="contains($str,$splitString)">


              <xsl:value-of select="substring-before($str,$splitString)"/>


            <xsl:call-template name="tokens">

              <xsl:with-param name="str" select="substring-after($str,$splitString)"/>

              <xsl:with-param name="splitString" select="$splitString"/>





              <xsl:value-of select="$str"/>





    3. Add the third “Inline XSLT Call Template” scripting functoid to you map.

    Use your “single line” as the input and map the functoid to the “PATLoop1” element.

      <xsl:template name="CreateDTMSegments">

        <xsl:param name="stringInput"/>

        <xsl:variable name="LineArray">

          <xsl:call-template name="tokens">

            <xsl:with-param name="str" select="translate(normalize-space(substring($stringInput,1, string-length($stringInput)-1)),' ','')"/>

            <xsl:with-param name="splitString" select="'%'"/>



        <xsl:for-each select="msxsl:node-set($LineArray)//Line">

          <xsl:call-template name="DTM">

            <xsl:with-param name="DTM_Date" select="concat(concat('20',substring(.,7,2)),substring(.,4,2),substring(.,1,2))"/>

            <xsl:with-param name="PCD_qualifier" select="substring(.,9,2)"/>




    Best regards 

    Rasmus Jaeger

    Monday, January 4, 2016 1:17 PM