File Splitter

Viewing 1 reply thread
  • Author
    Posts
    • #23391

      Hi

      I am trying to disassemble a file into two different messages. The file I recieve is of the X12 format. My question here is,

      1. How do i split these files? Can i use a pipeline debatching component or should i do it in an orchestration. The two outgoing messages are of the same structure

      2. I have one more thing to do. I have field named “DATE” in the incoming file. I need to append this field into only one of the outgoing messages. How can i perform this?

      Any replies or suggestions would be of great help.

      Thanks in advance

      PV

    • #23392

      Hi PV,

       

         In both cases, you can use XLANGs and XPath (in an orchestration) to split your original message and construct your outgoing messages.

       

         Best,

       

         Daniel.

      • #23393

        Thanks Daniel for your reply

        Can you provide me with an example of how to use the XLANGs and XPATH..I am new to BizTalk. Kindly bear with me.

        Thanks you

        • #23400

          Hi,

           

             Let’s say your X12 message has the following XML contents (I’m taking the example of an X12 format of transaction type 271 and showing just a snippet of it), let’s call it mX12:

          <gen0:X12_00401_271 xmlns:gen0=”http://schemas.microsoft.com/BizTalk/EDI/X12/2006″><ST><ST01>271</ST01><ST02>ST02</ST02></ST&gt;

          … </gen0:X12_00401_271>

             Now, let’s say you just want to extract the ST node and put that into your output message mOut. First of all, in your orchestration, declare a String variable vXPath and a variable vXmlDocument of type System.Xml.XmlDocument, and define a Scope shape of transaction type Atomic. In your scope shape, define two variables of type System.Xml.XmlNode and System.Xml.XmlNodeList, let’s call them vXmlNode and vXmlNodeList.

             Then, in your scope shape, define an Expression shape and put the following code in it:

          vXPath = “/*[local-name()=’X12_00401_271′ and namespace-uri()=’http://schemas.microsoft.com/BizTalk/EDI/X12/2006′%5D/*%5Blocal-name()=’ST&#8217; and namespace-uri()=”]”;

          vXmlNodeList = xpath(mX12, vXPath);

          vXmlNode = vXmlNodeList.Item(0);

          vXmlDocument.LoadXml(“<ns0:YourSchemaName xmlns:ns0=” + System.Char.ToString(‘”‘) + “http://YourSchemaNamespace” + System.Char.ToString(‘”‘) + “>” + vXmlNode.InnerText + “</ns0:YourSchemaName>”;

          mOut = vXmlDocument;

           

             And you would follow the same pattern for your other output message.

           

             I hope this is enough information to get you going.

           

             Daniel.

           

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