Wiki source code of Average
Last modified by Abdelali EL MAJDOUBI on 2023/08/03 15:53
Show last authors
author | version | line-number | content |
---|---|---|---|
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". | ||
8 | * **${ixf:avg(xpathExp, "10")}** the outcome will be the sum of the value resulting from evaluating "xpathExp" and the number 10 dividing by 2. | ||
9 | * **${ixf:avg("10","12","100")}** the result will be 40,66, which is the sum of 10, 12 and 100 dividing by 3. | ||
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 | |||
20 | Let's suppose that the result obtained from evaluating //Documents/Order/DeliveryAddress/OrderLine/Price// is 30, so the average is 20.00. | ||
21 | |||
22 | == Note: == | ||
23 | |||
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. |