Inline datatype conversion

Sometimes it is necessary to convert data to a specific type in order to avoid possible errors during operation. In such cases you can use the inline 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
Default value
Example
CBool
Converts the data into a boolean (true / false)
false
$[CBool(Data source:Option1)]
CByte
Converts the data into a byte, an unsigned number from 0 to 255.
0
$[CByte(Data:SmallNumber)]
CChar
Converts the data into a character.
space
$[CChar(Data:Text)]
CDate
Converts the data into a date/time object.
Now
$[CDate(Data:StartDate)|MM dd yyyy]
CDbl
Converts the data into a double precision floating point value.
0.0
$[CDbl(products:price)] + 5.0
CDec
Converts the data to a decimal value.
Decimal values are fixed point numbers, useful for calculation monetary values.
0
$[products:price] * $[CDec(Margin)]
CInt
Converts the data into a 32-bit signed integer.
0
$[CInt(order:quantity)]
CLng
Converts the data into a 64-bit signed integer.
0
$[CLng(product:serial)]
CShort
Converts the data into a 16-bit signed integer.
0
$[CShort(order:quantity)]
CSng
Converts the data into a single precision floating point value.
0.0
$[CSng(order:price)]
CStr
Converts the data to a string
empty string
$[CStr(Data:Number)]

Type checking functions

The following conversion function checks if data can be converted to a certain type.
All functions return true or false.
Conversion function
Description
Default value
Example
IsBool
Can the data be converted into a boolean.
n/a
$[IsBool(Data source:Option1)]
IsByte
Can the data be converted into a byte.
n/a
$[IsByte(Data:SmallNumber)]
IsChar
Can the data be converted into a character.
n/a
$[IsChar(Data:Text)]
IsDate
Can the data be converted into a date/time object.
n/a
$[IsDate(Data:StartDate)]
IsDbl
Can the data be converted into a double precision floating point value.
n/a
$[IsDbl(products:price)]
IsCDec
Can the data be converted to a decimal value.
n/a
$[IsDec(Margin)]
IsInt
Can the data be converted into a 32-bit signed integer.
n/a
$[IsInt(order:quantity)]
IsLng
Can the data be converted into a 64-bit signed integer.
n/a
$[IsLng(product:serial)]
IsShort
Can the data be converted into a 16-bit signed integer.
n/a
$[IsShort(order:quantity)]
IsSng
Can the data be converted into a single precision floating point value.
n/a
$[IsSng(order:price)]
IsStr
Can the data be converted to a string
n/a
$[IsStr(Data:Number)]

Conversion error & default values

If a conversion fails because the data cannot be converted, a default value is used.
You can manually specify this value or use the built-in default ones.
To specify your own default value, write it after the query in the following format:
$[CInt(Charges:Allowance, 22)]
If the Allowance data cannot be converted to an integer, the value 22 is used.