Feb 112008
 

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; }

  • john

    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

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

  • hung

    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

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

  • Mike M

    Hi Eric:
    Found your name connected to a lot of BizTalk searches and looks like you are the right guy to talk to.
    I am an old legacy Gentran mapping guy and I am presented with a challenge on an inbound 856 map I am creating on BizTalk 2009. The map needs to create a tab delimited output file like below. We have two types of scenarios that we have to map for one a 856 for a newer type of phone and one for an older CDMA. When I started building the map I could see BizTalk didn’t seem to manage the HL loops very well so what I did was create an Equal Functoid with the HL03 = ‘K’ and used this as an implied loop to my repeating SLI record and it worked and I was very excited because I was able to do this with only the Visual Mapper and its complement of Functoids. Here is where my problem comes in. When we get an older CDMA phone I need to search the HL03 = ‘K’ and the HL03 = ‘Q’ each pass and create one SLI record. In other words in a legacy mapper I could have made both of these part of the same loopid and used IF conditions to get my desired output. Is there any way I can do this in BizTalk through the use of Functoids only or am I forced to use scripting? If I need scripting what would the XSLT look like to manage the HL03 = K and then Q? Thanks any help much appreciated.
    SHP
    ORD
    ITM
    SLI
    SLI
    SLI
    SLI

  • Eulade

    Hi. Great post. Just to complete you: If the Values is a repeating node, you will need to connect it to the cumulative Concat functoid first, and only then connect it to the String Concatenate functoid. Otherwise you’ll just output the first occurence of Values.