Message Assignment – Split a delimited string to retrieve a value

Home Page Forums BizTalk 2004 – BizTalk 2010 Message Assignment – Split a delimited string to retrieve a value

Viewing 4 reply threads
  • Author
    Posts
    • #21950

      I have an EDI file that my orchestration is retrieving from the message box (i.e. in xml).  I’d like to get one of the values from the ISA header – specifically ISA09 and ISA10.

      I can get entire string (into the Message Assignment shape) which looks like this.

      ISA*00*          *00*          *01*FIRST *01*98765LCSAPT*090318*1420*U*00401*000442082*0*T*^~

      How can I split this to get the two values?  ‘090318’ and ‘1420’?  I seem to not be able to use String.Split, so I may be doing something wrong there.

      Thanks.

    • #21957

      Write a component which will do this for you.  Maybe make one method which takes the position you want returned.

       

    • #21962

      Can you promote the fields and get them that way?

      Like:

      stringISA09 = YourInstance(YourNamespace.PropertySchema.ISA09)

      • #21990

        I think that a component will need to be the answer.  The ISA fields are in the header of the original message, so can’t be promoted in a schema (so far as I know) – otherwise, no problem.

        Fundamentally , this is a question about how to write C# in the Message Assignment and Expression Shapes.  Does anyone know of a tutorial that addresses this?  My fumbling around with ‘guessing’ what is available and not in these shapes is very frustrating.

        Thanks for the help.

        • #22013

          If your original schema is an Envelope and the content get splitted to secveral messages, the promoted property from the “Header” is available in each message’s Message Context. See the SDK for the dissassembler/assembler sample.

          But if you like to continue the C# road here is a sample:

          string header = “ISA*00*          *00*          *01*FIRST *01*98765LCSAPT*090318*1420*U*00401*000442082*0*T*^~”;

          string [] arr = header.Split(‘*’);

          string first = arr[9];
          string second = arr[10];

          Compile this into an assembly, reference this assembly from your biztalk project and you are ready to use it from an expression shape. When using in runtime it has to be in the GAC, and for that reason strong named.

          Kind Regards
          Martin Bring

    • #49794
      biztalkgurus

        The Prettiest by Brigit Young • 9781626729230

      • #51460
        khalis

          Good ost

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