BizTalk Business Rules Engine - Repeating Elements Question

Posted by Andrew Cripps on Stack Overflow See other posts from Stack Overflow or by Andrew Cripps
Published on 2010-02-10T15:11:23Z Indexed on 2010/03/18 2:11 UTC
Read the original article Hit count: 450

Filed under:


I'm trying to create what I think should be a relatively simple business rule to operate over repeating elements in an XML schema.

Consider the following XML snippet (this is simplified with namespaces removed, for readability):

    <Account id="1" currentPayment="10.00" arrearsAmount="25.00">
        <Customer id="20" primary="true" canSelfServe="false" />
        <Customer id="21" primary="false" canSelfServe="false" />
    <Account id="2" currentPayment="10.00" arrearsAmount="15.00">
        <Customer id="30" primary="true" canSelfServe="false" />
        <Customer id="31" primary="false" canSelfServe="false" />

What I want to do is to have two rules:

  • Set /Root/AllAccounts/Account[x]/AllCustomers/Customer[primary='true']/canSelfServe = true IF arrearsAmount < currentPayment
  • Set /Root/AllAccounts/Account[x]/AllCustoemrs/Customer[primary='true']/canSelfServer = false IF arrearsAmount >= currentPayment

Where [x] is 0...number of /Root/AllAccounts/Account records present in the XML.

I've tried two simple rules for this, and each rule seems to fire x * x times, where x is the number of Account records in the XML. I only want each rule to fire once for each Account record.

Any help greatly appreciated!



© Stack Overflow or respective owner

Related posts about BizTalk

Related posts about business-rules