Message Splitting Problem on <Choice>

Home Page Forums BizTalk 2004 – BizTalk 2010 Message Splitting Problem on <Choice>

Viewing 1 reply thread
  • Author
    • #13283


      I have this situation in creating Biztalk Orchestration.

      I have this kind of schema

      <MainSchema> (root)
      – <a>
      – <Choice> (*meaning select one from the following)
      – <c1>
      – <c2>
      – <c3>

      *Also note that Choice is unbounded which means any combination of the 3 choices (c1, c2, c3) can be created and can appear any number of times.

      So what I want is to navigate through the unbounded choices and send them out depending on the choices.

      for example: <MainSchema>

      So given this example. I will send all <c1> to location C:\\C1, then <c2> to C:\\C2, then <c3> to C:\\C3 but I want to do it in the order, meaning <c1>1</c1> will be first then followed by <c1>2</c1> then followed by <c3>4</c3> then <c2>5</c2>.

      How am I going to do this on the Orchestration?

      Solution from won’t be useful since Choice doesn’t have an xpath.

      Can anyone please help me? If there is anything not clear about my explanation, please let me know.


    • #13284


      To simplify my point here…

      given this article, instead of a [b:45a01d3a98]Record[/b:45a01d3a98] that is [i:45a01d3a98]Unbounded[/i:45a01d3a98], it is the [b:45a01d3a98]<Choice>[/b:45a01d3a98] which is [i:45a01d3a98]unbounded[/i:45a01d3a98].

      How can I debatch the Choices?

      Thanks again,

      • #13285

        Hi Greg,

        Thanks for the quick reply, I am not just clear on the part of ordering the output wherein you said that I will need to map with some custom XLST using the <xsl:sort> feature

        how do you see it working? it seems I can’t visualize it? Could you give me an example, even a simple example?


        • #13286

          Hi Greg,

          Thanks again for your quick reply. No, there is no need to sort the document. I just need it in the same order that it was passed.

          but here is my question what if I had this schema

          <Main Schema>

          wherein there are more than one record/element before the choice, how will I loop through the choice elements?

          It seems with your solution earlier, I would be able to exclude only <a>; is there a way wherein I could exclude also the others so that I could get only the choice part and loop through it?

          I would like to make it as dynamic as possible so that I would not need to change much if the schema would change in the near future.


          • #13287

            Hi Greg,

            Thanks again for the quick response. I was wondering if there is a standard or proper structure for debatching message?

            From what I know is that an ideal structure should be

            – <OrderDetails>
            – <LineItem>
            – <ID>
            – <Qty>

            is this the standard structure for debatching?


            • #13288

              Hi Greg,

              Thanks again. I’ve tried your method and it worked well.

              Thank you very much.


              • #13289

                Here is one way of selecting the <choice> nodes.

                Count = count(/MainSchema/child::*[not(a)])

                xpathStr = System.String.Format(/MainSchema/child::*[not(a)][{0}], Counter)

                However the tricky bit is ordering the output, you will probably need a map with some custom XLST using the <xsl:sort> feature [url][/url]

                • #13290

                  The xpath example will iterate through the Cx nodes one by one, however the order will be determined by the order in the incoming document.

                  I guess I did not understand what was the determining factor for the order. Is it based on the order in the document or on the value in the Cx record.

                  e.g. If the order is determined by the value in each Cx node and the document looks like this:

                  Then you will need to sort the incoming document first, before iterating thru the Cx nodes.

                  If the order in the document is the correct order, then there is no need to sort it.

                  • #13291

                    You can change the axis and predicate in the xpath to select only the nodes you want.
                    Here are some examples; tested against your example:
                    [code:1:a2be6d0c10]/MainSchema/child::*[local-name()!=’a’ and local-name()!=’b’ and local-name()!=’c’][{0}][/code:1:a2be6d0c10]
                    [code:1:a2be6d0c10]/MainSchema/child::*[substring(local-name(),1,1)=’c’ and string-length(local-name()) > 1][{0}][/code:1:a2be6d0c10]

                    • #13292


                      Not sure exactly what you mean by a standard or proper structure for debatching.

                      There are a number of Xml standards for business documents. I have used 2 of these in a Biztalk environment, UBL from OASIS and OAGIS from Open Applicatons Group.
                      You might like to check them out at

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