FormatInteger
(VTScada-Layer function. Must be called with a leading backslash.)
Description: | Given a numeric value, returns that value converted to Hex, Octal or Binary as specified. |
Returns: | Text |
Usage: | Script or steady state. |
Function Groups: | Math - Generic Functions, String and Buffer |
Related to: | Format | FormatNumber |
Format: | \FormatInteger(Value, OutputFormat, Size, LeadingZeros) |
Parameters: |
Value |
Required. Any numeric expression giving the original decimal value to be converted. |
OutputFormat |
Required. The format to convert to. Constants are used as follows: (Note the leading backslash in each case.) \#HEX \#OCTAL \#BINARY |
Size |
Required. The size of the result to return. May be one of: \#DATA_BYTE \#DATA_WORD \#DATA_DWORD \#DATA_QWORD |
LeadingZeros |
Optional. A Boolean. If TRUE, the output will be padded with leading zeros according to the size specified. Defaults to FALSE. |
Comments: | Must be preceded by a backslash. Useful for formatting a numeric value into one of the three available representations. |
Example:
Result = \FormatInteger(25, \#OCTAL, \#DATA_WORD, 0);
The variable Result will be "31".