Script functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,…: Converts the data type of a value.
CONVERT (Data type, value)
Syntax |
Description/Format |
---|---|
Data type |
Data type to which conversion is required. unsigned: positive integers without signs Data types are indicated without inverted commas. |
Value |
Value whose data type should be converted to a different data type. Format: script literal or script variable Numbers must also be specified in inverted commas. |
Return code |
---|
Value including the converted data type. |
This scriptA particular Automation Engine object type. function can be used to convert the data type of a value that has been specified directly or via a script variableA placeholder for a value within a script. to a different data type. The return codeThe value that represents the result of tasks and script functions. is the converted value which must be assigned to a target variableIt stores or retrieves values dynamically at runtime. An individual Automation Engine object type..
Ensure that the data type of the value that should be converted complies with the target variable's data type when you use this script function.
Strings can only be converted to numbers if the string includes a number in a valid format.
Attempts to convert a higher number type to a lower one have the effect that decimal numbers are rounded or signs are removed.
Conversion is not possible if the target variable's data type does not comply with the function's parameter "Data type". The result is a scripting error.
Note that you cannot convert negative numbers with this script function
The first example converts a positive integer into a string.
:define &unsigned#, unsigned
:define &string#, string
:set &unsigned# = 12
:set &string# = CONVERT(string, &unsigned#)
The second example converts a string to a number. This is only possible if the string consists of a number that has a valid format for the target data type.
:define &unsigned#, unsigned
:define &string#, string
:set &string# = "1234"
:set &unsigned# = CONVERT(unsigned,&string#)
See also:
Script Elements - Editing Objects
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function
Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support |
Copyright © 2016 Automic Software GmbH |