INCVARIABLE

The INCVARIABLE function increments the numeric value for a flow variable.

This function defines a new flow variable if it does not exist already and sets the specified increment value as the initial value for the new flow variable. If the increment value is not specified, it defaults to 1, and returns the set value in text format.

If the flow variable exists already and holds a numeric value, this function increments by the specified increment value. If the increment value is not specified, it increments the numeric value associated to a flow variable by 1, and returns the set value in text format to the map. The value associated to a flow variable is non-numeric, then this function skips performing increment operation on the value of the flow variable, leaves the non-numeric value intact.

Syntax:
INCVARIABLE ( single-text-expression [, single-text-expression] )
Meaning:
INCVARIABLE ( variable_name [, increment_by] )
Returns:
A single text item

Examples

  • flowlib->INCVARIABLE ( “interest.rate” )

    Increments the value of flow variable, interest.rate, by 1 and returns the incremented value in text format. If the flow variable, interest.rate, does not exist already, creates one by that name, assigns 1 and returns “1”.

  • flowlib->INCVARIABLE ( “interest.rate”, 10 )

    Increments the value of flow variable, interest.rate, by 10 and returns the incremented value in text format. If the flow variable, interest.rate, does not exist already, creates one by that name, assigns 10 and returns “10”.

  • flowlib->INCVARIABLE ( “city” )

    Returns empty value, if the flow variable, city, holds a non-numeric text value as ‘New York’. Increment operation is not performed and retains the value of the flow variable intact as ‘New York’. If the flow variable, city, does not exist already, then a new flow variable, city, is created and set with value 1, returns “1” to the map.