BizTalk Business Rules Engine - Vocabulary Get and Set

Posted on 2:57pm 5/22/2008 by Bruno Silva in Programming

During the last couple of days I’ve been exploring BizTalk 2006 Business Rules Engine for a college assignment.

The objective is calculating the total cost of a travel. The input is the number of days the customer was staying in the destination, and the number of touristic spots he wanted to visit. The business rules defined the price per night of the stay and the price per visit. These values added to the flight cost gives us the total cost of the travel.

There is a nice tutorial about the BizTalk 2004 version of the rule composer which is quite similar to the 2006 version (at least in the UI). After some search I was unable to find an answer to my particular problem (was it that obvious?… read further and tell me).

I wanted to calculate the cost per visit and cost per night within the policy (I wanted to set these values) and I also wanted to calculate the total cost of the travel based on those variables (by getting their values).

(I am using an XML file as input which has the elements I talked about before)

When you create a definition in your vocabulary (which you use do define rules in your policy) you must select the operation you want to do over the element: Get or Set. You can choose only one of them…

BizTalk Vocabulary Definition

So, what’s the trick to perform both actions? Create two definitions of the same element, one as Get and the other as Set.

When a rule uses the Set definition of the element, all the rules that use the Get definition of that XML element read the updated value.

Works great! Just be careful about rules priority. Make sure that rules that read the element value are called after a rule that sets it’s value.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Bruno Silva | Powered by Wordpress