Summary
This script uses the divide and sqrt commands to perform a calculation on rr and qt and then assigns the result to qtcb. qt is divided by the square root of rr divided by 1000. qtcb = qt/(square root (rr/1000)). All dependent values 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-qtcb"> <body> <s:if> <s:and> <s:isSet> <s:question> <s:question path=".qt"/> </s:question> </s:isSet> <s:gt> <s:numberPath path=".qt:value"/> <s:number value="0"/> </s:gt> <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=".qtcb"/> <s:divide> <s:numberPath path=".qt:value"/> <s:sqrt> <s:divide> <s:numberPath path=".rr:value"/> <s:number value="1000"/> </s:divide> </s:sqrt> </s:divide> </s:assign> <s:assign> <s:question path=".qtcb"/> <s:string value=""/> </s:assign> </s:if> </body> <target typeId="qt" when="preprocess" shouldReconcile='true'/> <target typeId="rr" when="preprocess" shouldReconcile='true'/> </script>
Need more help?
Please visit the Fountayn Contact Information page.