$WBDV - decrement value

Important: $WBDV function has effect on entire WBSP page and all it's sub elements (configuration section, included files, sub reports, etc.). All instances of $WBDV function that use the same variable name will set same variable regardless of their location inside WBSP page (e.g. $WBDV[somevar] in main WBSP page and $WBDV[somevar] in subreport will change (decrement by 1) the value of the same variable named somevar.

Availability
$WBDV is available for use with all WBSP commands.

Syntax
$WBDV{varname|decrement|showvar}
$WBDV[varname|decrement|showvar]

Parameters
varname - the name of global WBSP variable to be decremented
decrement - optional parameter  -  the value that will be subtracted from the existing value of varname. Default value is 1.
showvar - optional parameter - if set to true (T,ON,1) WhizBase will show the assigned value

Returns
New (decremented) value if showvar parameter is set to true, otherwise it returns nothing, just sets the value of a variable.

Example

<!--
[FormFields]
wb_command=r
-->
<!--WB_BeginTemplate-->
<html>
<head>
<title>WBDV</title>
</head>
<body>
$WBSETV[loopcounter|10]
$WBWHILE[$wbgetv[loopcounter]>0|
The loopcounter value is:$wbgetv[loopcounter]<br>
$WBDV[loopcounter]
]
Loop ended, loopcounter value is $wbgetv[loopcounter]!
</body>
</html>

After running this example, the resulting page in browser may look like this:

The loopcounter value is:10
The loopcounter value is:9
The loopcounter value is:8
The loopcounter value is:7
The loopcounter value is:6
The loopcounter value is:5
The loopcounter value is:4
The loopcounter value is:3
The loopcounter value is:2
The loopcounter value is:1
Loop ended, loopcounter value is 0!