XPath sum in BRE becomes type double

Using the Business Rules Engine (BRE), you can use XPath functions like sum in vocabulary definitions. For example, I had a vocabulary definition where I wanted to calculate the total tax from an EDIFACT invoice. I had the following definition:

XPath Selector: /*[local-name()=’EFACT_D03A_INVOIC’ and namespace-uri()=’http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006′%5D

XPath Field: sum(./*[local-name()=’TAXLoop5′ and namespace-uri()=’http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006′]/*[local-name()=’MOA_14′ and namespace-uri()=’http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006′]/*[local-name()=’C516_14′ and namespace-uri()=’http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006′][C51601=’124′]/*[local-name()=’C51602′ and namespace-uri()=”])

I noticed that this returned a double, so you should use that type in the definition, otherwise you might get conversion errors.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s