Summary

This article covers the Sign Inverse command. 


Description

This script subtracts 2 values from the first value and then uses the sign command to invert the sign on the result (effectively multiplying the result by negative one). monthlyBacklogAdjust is assigned the value of (previousBacklog – billMonthRevenue – currentBacklog)*(-1).

Note: the second instance of the ‘assign’ command is necessary to assign a blank value if the initial questions are not set.


Script


<script scriptId="monthly_backlog_adjustment">
    <body>
      <s:if>
      <s:and>
            <s:isSet>
                <s:question>
                    <s:question path=".previousBacklog"/>
                </s:question>
            </s:isSet>
            <s:isSet>
                <s:question>
                    <s:question path=".billMonthRevenue"/>
                </s:question>
            </s:isSet>
            <s:isSet>
                <s:question>
                    <s:question path=".currentBacklog"/>
                </s:question>
            </s:isSet>
        </s:and>
        <s:assign>
            <s:question path=".monthlyBacklogAdjust"/>
            <s:sign>
                <s:subtract>
                    <s:numberPath path=".previousBacklog:value"/>
                    <s:numberPath path=".billMonthRevenue:value"/>
                    <s:numberPath path=".currentBacklog:value"/>
                </s:subtract>
            </s:sign>
        </s:assign>
        <s:assign>
           <s:question path=".monthlyBacklogAdjust"/>
            <s:string value=""/>
        </s:assign>
        </s:if>
    </body>
    <target typeId="billMonthRevenue" when="preprocess" shouldReconcile='true'/>
    <target typeId="previousBacklog" when="preprocess" shouldReconcile='true'/>
    <target typeId="currentBacklog" when="preprocess" shouldReconcile='true'/>
</script>



Need more help?

Please visit the Fountayn Contact Information page.