Promotic
Login logon

FormatNumber - function of language VBScript

Description:
Returns an expression formatted as a number.
In the PROMOTIC system it is better to use the PmFormat object, see for example Examples for Float type.
Syntax:
String FormatNumber(Variant Value, [Variant DigitsAfterDecimal], [Variant LeadingDigit], [Long ParensForNegative], [Long GroupDigits])
Parameters:
Value(Variant) Value to be formatted
DigitsAfterDecimal[optional] (Variant) Numeric value specifies how many places to the right of the decimal are shown.
The default value is -1 (means depending on the locale settings of Windows system).
LeadingDigit[optional] (Variant) Constant specifies whether a leading zero is shown for decimal values
-1=vbTrue - Show
0=vbFalse - Hide
-2=vbUseDefault - use computer default setting
ParensForNegative[optional] (Long) Constant specifies whether to place negative values within parentheses
-1=vbTrue - to place within parentheses
0=vbFalse - not to place within parentheses
-2=vbUseDefault - use computer default setting
GroupDigits[optional] (Long) Constant specifies whether numbers are grouped using the group delimiter specified in the control panel
-1=vbTrue - grouped
0=vbFalse - not grouped
-2=vbUseDefault - use computer default setting
Note:
If one or more of the optional arguments are omitted, then the values for the omitted arguments are depending on the locale settings of Windows system.
All settings information comes from the "Number" tab in the locale settings of Windows system.
Example:
VBScriptSelect and copy to clipboard

Dim nAngle, nSecant, sNumber
nAngle = 1.3
nSecant = 1 / Cos(nAngle)
sNumber = FormatNumber(nSecant, 4)   ' Format nSecant to 4 decimal places
PROMOTIC 9.0.34 SCADA system documentation MICROSYS, spol. s r.o.

Send page remark Contact responsible person
© MICROSYS, spol. s r.o.Update cookies preferences