Summary

This article covers the average command. 


Description

This command accepts any number of Number arguments and returns the average of the inputs.

Note: There is no need to check if the values are set. The average command only recognizes arguments that are not null and should be included in the average. Therefore, if you have 5 questions and only 2 of them are answered, only those 2 will be used in the calculation. 


Attributes

  • None

Parameters

Example

<script scriptId="averageCalculation">
    <body>
                <s:assign>
                    <s:question path=".average"/>
                    
                    <s:average>
                            <s:numberPath path=".num1:value"/>
                            <s:numberPath path=".num2:value"/>
                            <s:numberPath path=".num3:value"/>
                    </s:average>
                    
                </s:assign>
                <s:assign>
                <s:question path=".average" />
                <s:string value=""/>
                </s:assign> 
    </body> 
    <target typeId="formA" when="preprocess" shouldReconcile='true' /> 
</script>

Need more help?

Please visit the Fountayn Contact Information page.