Summary
This script uses the divide command to perform a calculation on the rr question and then assign the result to the rate question. The rate question is assigned the value of 60000 divided by the rr question (Rate = 60000/rr). The rr question must be greater than zero.
Note: Please note the second instance of the 'assign' command. This is necessary to assign a blank value if the initial questions are not set.
Script
<script scriptId="set-rate"> <body> <s:if> <s:and> <s:isSet> <s:question> <s:question path=".rr"/> </s:question> </s:isSet> <s:gt> <s:numberPath path=".rr:value"/> <s:number value="0"/> </s:gt> </s:and> <s:assign> <s:question path=".rate"/> <s:divide> <s:number value="60000"/> <s:numberPath path=".rr:value"/> </s:divide> </s:assign> <s:assign> <s:question path=".rate"/> <s:string value=""/> </s:assign> </s:if> </body> <target typeId="rr" when="preprocess" shouldReconcile='true'/> </script>
Need more help?
Please visit the Fountayn Contact Information page.