Looping and a Decide Shape

Home Page Forums BizTalk 2004 – BizTalk 2010 Looping and a Decide Shape

Viewing 1 reply thread
  • Author
    Posts
    • #14031

      Hi BizTalk Gurus

      I’m a newbie at this so I don’t think this will be a tough question.

      I have a master detail schema like:
      [code:1:9dff755f2d]<Order>
      <Item>blah</Item>
      <Item>blahblah</Item>
      <Item>widget</Item>
      </order>[/code:1:9dff755f2d]

      The problem is that the orchestration needs to process each <Item> and that process depends on the value of <Item>. I want to use a decide shape based on the value of <Item>. I’ve read in a tutorial to promote the Item in the schema and then use a decide shape based on that value. When I go to promote the <Item> element, I get an error message saying that I cannot promote a value that occurs multiple times.

      My 2 questions are:
      1) How do you use the Looping element in a orchestration so that I only loop x number of elements passed in?
      2) How do I use a decide shape that filter on the value of <Item>?

      Any help would be greatly appreciated.

      Thanks, Bill N

    • #14030

      To loop thru the items you need to create an orchestration variable and set this to the number of item nodes in the message.
      You can then extract the value from Item within the loop using count as an index.

      [code:1:c73a949431]count = xpath(message, \"count(/Order/Item)\");

      loop while count > 0
      itemValue = xpath(message, \"/Order/Item[count]/text()\");
      //decide logic
      count–;[/code:1:c73a949431]

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