Introduction

The average function calculates the middle number of a set of numbers by adding them all together and then dividing by how many numbers there are.

Syntax :

  • ${ixf:avg(xpathExp1, xpathExp2)} calculates the average of the results obtained from evaluating "xpathExp1" and "xpathExp2".
  • ${ixf:avg(xpathExp, "10")} the outcome will be the sum of the value resulting from evaluating "xpathExp" and the number 10 dividing by 2.
  • ${ixf:avg("10","12","100")}  the result will be 40,66, which is the sum of  10, 12 and 100 dividing by 3.

Ensure that numerical values are between double quotes : ${ixf:avg("10","12","100")},

while xpath expressions should remain without any quote enclosures.

Example :

  • ${ixf:avg(Documents/Order/DeliveryAddress/OrderLine/Price,"10"}

Let's suppose that the result obtained from evaluating Documents/Order/DeliveryAddress/OrderLine/Price is 30, so the average is 20.00.

Note:

  • Numerical values can be also enclosed within single quotes : ${ixf:avg('10','12','100')} OR mix single and double quotes, like this: ${ixf:avg("10",'12','100')}.
  • The default display for the average includes two decimal places.
Tags:
    
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian