The Avg function returns the average of a set of numeric values from a set of elements.
The average is the sum of a set of numbers divided by the number of values in the set.
To create an output element that determines the average value from a set of elements from an input feed, the elements used must be nested within a higher level element.
For example, an input operator to the current operator contains an element named <feed>
that contains several child elements named <entry>
To determine the average value of the <entry>
elements, for the Expression Value
parameter you would select Specify a value from the Input tree
. In the tree, you would select the <entry>
element or a child element of the <entry>
A numeric value that you want to return the average from.
For the Value
field, choose one of the following actions:
- Specify a text value. (For this function, specify a numeric value.)
- Specify a function value.
- Use a variable to return the value.
- Specify a value from the Input tree.
When you apply the Avg function to an output feed element, the output feed contains a single element with a Numeric value.
In the following example of an input feed, the containing element is the school
element that contains instances of the child element studentCount
, and the value of studentCount
is the number of students in the room:
The Expression Value
for the Avg function would look similar to:
In this example, when you use the Avg function to create a new output feed element, all of the instances of studentCount
from the input feed are used as input. The output feed contains a single element with a numeric value that represents the average value of the studentCount
The preview of the output feed contains the output element, and the value of the element is the average of the studentCount
Parent topic: Builtin functions: imc3
Using aggregate functions effectively: imc3