Conversion

Sometimes it is necessary to convert a value from one type to another. In most cases you won’t need to bother with this, but you may get an error when two values are not of the same type. In such cases you can use the conversion functions below.
Data from XML data sources and merge parameters is always text (the type is string). This means that you may have to convert it into a number before you can use it in a calculation.
Conversion function
Description
Example
CBool
Converts the data into a boolean (true / false)
CBool("False")
CByte
Converts the data into a byte, an unsigned number from 0 to 255.
CByte("7")
CChar
Converts the data into a character.
CChar("Some text")
CDate
Converts the data into a date/time object.
CDate("2004-05-12")
CDbl
Converts the data into a double precision floating point value.
CDbl($[data:price]) * 1.19
CDec
Converts the data to a decimal value.
Decimal values are fixed point numbers, useful for calculation monetary values.
$[products:price] * CDec($[Margin])
CInt
Converts the data into a 32-bit signed integer.
CInt("12")
CLng
Converts the data into a 64-bit signed integer.
CLng("123456789")
CShort
Converts the data into a 16-bit signed integer.
CShort("32000")
CSng
Converts the data into a single precision floating point value.
CSng("12.4")
CStr
Converts the data to a string
CStr(12)

Conversion errors

If a conversion fails because the data cannot be converted, an error is thrown.
See also: