Summary

This command increments/decrements the value of a property with an integer value.


Attributes

  • none

Parameters

  • name – (string) This is the name of the property to change.
  • step – (string) This is the amount to increment/decrement the property.(negative numbers will decrement).
  • default – (string) This is the value to use if the property does not exist.


Note: While the values for the 'step' and 'default' should be numbers in the script, they are technically stored as strings. When comparing to the property values in another script, the value must be wrapped in a 'toNumber' command. 



Note: The ‘when’ property should be set to “after” for this command to assure that it only increments/decrements when the question is saved without opening any new alerts. Otherwise, the script could increment the value every time the question is saved. 



Note: When using the Increment Property, if another form contains an assignment back to the form with the Increment command and reconcile is run on the form with the assignment the incremental numbering increases by one causing the loss of values in the sequence. It is best practice to not create an assignment on another form that writes back to the form with the incremental command. 



Note: ‘shouldReconcile’ is set to ***false*** so that the script will not be evaluated again upon use of the reconcile utility. This script will execute only when data entry is done. 



Note: Do not use the local command to make any assumptions on the returned value of the next call to the incrementProperty command, as concurrent users’ activity can have impacts on the returned value from incrementProperty. First calling the incrementProperty command and then using local command should ensure that you always work with the same value. 



Example

<script scriptId="incrementReqID">
    <body>
    
        <s:incrementProperty>
            <s:name>
                <s:string value="reqID"/>
            </s:name>
            <s:step>
                <s:number value="1"/>
            </s:step>
            <s:default>
                <s:number value="0"/>
            </s:default>
        </s:incrementProperty>
        
    </body>
    <target action="update" typeId="requestor" when="after" shouldReconcile="false" />
</script>



Need more help?

Please visit the Fountayn Contact Information page.