Extract the iteration from a repeating loop designated by a certain qualifier

A while back I posted a solution that helped me extract the value from a repeating loop designated by a qualifier.  I've seen this come up many times with EDI, either you're extracting a ST or ship-to information or a REF reference information.  Although my previous solution worked it involved adding 4 functiods and changing data within the scripting functiod depending on the Qualifier.  I've simplified it to only require 3 functoids and no need for adjusting the script inside of the functoid. 

 

Here's an example of what your 3 functoid would look like.

image

 

1.  Add a "^" before and after the Qualifier

image

2.  The scope of the Cumulative Concatenate Functoid should be 1.

image

3.  The Scripting Functoid Input will be the Qualifier you're wanting to find and the output from the Cumulative Concatenate functoid.

image

4.  Finally Insert the following code into the Scripting Functoid (Inline Visual Basic .NET)

Public Function RepeatingLoopWithQualifier_1(ByVal Qualifier As String, ByVal All_Qualifiers_and_Values_Concatonated As String) As String 'All_Qualifiers_and_Values_Concatonated Expects a Commulative Concatonated String of all 'Qualifers preceded by a "^" and Values preceded by a "^" for example ^ST^912 Summer DR.^BT^4312 W. Powell Dim QualifierLocation As Integer = All_Qualifiers_and_Values_Concatonated.IndexOf("^" + Qualifier + "^") Dim QualifierandValueSplit As String() 'If Qualifier is found, find the corresponding Value, else Return "" If QualifierLocation >= 0 Then QualifierandValueSplit = All_Qualifiers_and_Values_Concatonated.Substring(QualifierLocation + 1, All_Qualifiers_and_Values_Concatonated.Length - (QualifierLocation + 1)).Split("^") Return QualifierandValueSplit(1) Else Return "" End If End Function

Here's the same logic in C#

public string RepeatingLoopWithQualifier_1(string str_Qualifier, string str_AllQualifiers_and_Values_Concatonated) { string[] _ary = str_AllQualifiers_and_Values_Concatonated.Split(new char[] {'^'}); string result = ""; if (str_AllQualifiers_and_Values_Concatonated.IndexOf("^" + str_Qualifier.Trim() + "^")>-1) for (int i=0; i< _ary.Length; i++) { if (_ary[i] == str_Qualifier.Trim()) result = _ary[i+1]; } return result; }

posted @ Monday, February 11, 2008 12:00 PM

Print

Comments on this entry:

 re: Extract the iteration from a repeating loop designated by a certain qualifier

Left by john at 4/21/2008 5:57 AM
Gravatar

Hi
I work with BizTalk server 2006 and I have a big problem with it, I will be thankful if you can help me.
I want to create a process in BizTalk orchestrator which runs in SharePoint and assign tasks to users.

I can create process and run it in SharePoint but all tasks (of process) is run for one user, So my problem is how to assign each task to each user (SharePoint users).
Best Regard

# re: Extract the iteration from a repeating loop designated by a certain qualifier

Left by Eric at 4/21/2008 7:46 AM
Gravatar

I tried to contact you at your email you provided, but no luck.

 re: Extract the iteration from a repeating loop designated by a certain qualifier

Left by hung at 4/30/2008 6:55 PM
Gravatar

Yes,
You are great.
I did the samething 1 year ago. I can you xslt or use a c# cummulative string functoid to extract virtual loop data::)
You picked the cummulative string functoid trick.
In this string, you parse out the qualifier and it's data.
It is XSLT functional programming versus C# procedure.
I AM SO GLAD we have this bridge

# re: Extract the iteration from a repeating loop designated by a certain qualifier

Left by david at 5/19/2009 10:25 PM
Gravatar

thanks eric for this tip. working on my first BTS project.

Your comment:



 (will not be displayed)


 
 
 
Please add 1 and 2 and type the answer here:
 

Live Comment Preview:

 
«March»
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910