Hide last authors
Abdelali EL MAJDOUBI 1.1 1 = Introduction =
2
3 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.
4
5 == Syntax : ==
6
7 * **${ixf:avg(xpathExp1, xpathExp2)}** calculates the average of the results obtained from evaluating "xpathExp1" and "xpathExp2".
Abdelali EL MAJDOUBI 1.6 8 * **${ixf:avg(xpathExp, "10")}** the outcome will be the average of the value resulting from evaluating "xpathExp" and the number 10.
Abdelali EL MAJDOUBI 1.3 9 * **${ixf:avg("10","12","100")}**  the result will be 40,66, which is the sum of  10 and 12 and 100 dividing by 3.
Abdelali EL MAJDOUBI 1.1 10
11 Ensure that numerical values are between double quotes : ${ixf:avg("10","12","100")},
12
13 while xpath expressions should remain without any quote enclosures.
14
15
16 == Example : ==
17
18 * **${ixf:avg(Documents/Order/DeliveryAddress/OrderLine/Price,"10"}**
19
Abdelali EL MAJDOUBI 1.6 20 Let's suppose that the result obtained from evaluating //Documents/Order/DeliveryAddress/OrderLine/Price// is 30, so the average is 20.00.
Abdelali EL MAJDOUBI 1.1 21
22 == Note: ==
23
Abdelali EL MAJDOUBI 1.2 24 * 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')}.
25 * The default display for the average includes **two** decimal places.
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian