Wednesday, May 27, 2015

Alternative to use String.Split function in BizTalk Orchstration

My requirement is to get the 6th ISA segment value.

The var_ISASegment contains this value "ISA*00*          *00*          *01*FIRST *01*98765LCSAPT*090318*1420*U*00401*000442082*0*T*^~"

Solution:
We will have to use an expression shape and a loop and Expression shape


Place this below condition in the loop
var_counter < 8


 create 3 variables (var_PrvPosition, var_curntPosition, var_counter) with int data type.  

  • var_PrvPosition used to store the startup position.  
  • var_curntPosition used to store  index of our delimiter 
  • var_counter used to store the segment number.


Place below code in the expression shape
var_PrvPosition ++;
var_curntPosition = var_ISASegment.IndexOf("*",var_PrvPosition);
               
var_counter++;
if (counter == 7)
{
  Var_SixthSegment = var_ISASegment.Substring(var_PrvPosition, var_curntPositionvar_PrvPosition));
}

var_PrvPosition = indexCurrentPosition;


No comments:

Post a Comment