ToInteger Function

Use ToInteger to convert values from a different data type to a whole number.
ToInteger supports the following data types:
  • text
  • decimal number
  • yes/no (boolean)
  • date
  • whole number
Description 1 of 8 (convert a text value):
Convert a text value to a whole number value.
If the text value corresponds to a decimal number then it is rounded down (towards zero) to the nearest whole number.
Returns:
Whole Number
Parameter:
Parameter
Data Type
Description
1
Text
The text to be converted.
Examples:
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
Expression
Result
ToInteger( "2" )
2
ToInteger( "2.5" )
2
ToInteger( "-2.5" )
-2
ToInteger( "3.5" )
4 (if integer is halfway between two whole numbers, the nearest even number is returned)
Description 2 of 8 (convert a decimal number value):
Convert a number to a whole number by rounding down (towards zero) to the nearest whole number.
This function is equivalent to either of:
  • RoundDown(
    value
    , 0 )
  • Floor(
    value
    , 1 )
Returns:
Whole Number
Parameter:
Parameter
Data Type
Description
1
Number
The number to be converted.
Examples:
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
Expression
Result
ToInteger( 2 )
2
ToInteger( 2.5 )
2
ToInteger( -2.5 )
-2
ToInteger( 3.5 )
4 (if integer is halfway between two whole numbers, the nearest even number is returned)
Description 3 of 8 (convert a boolean value):
Convert a boolean value to a whole number value.
The boolean value
true
is converted to the number
1
and the boolean value
false
is converted to the number
0
.
Returns:
Whole Number
Parameter:
Parameter
Data Type
Description
1
Boolean
The boolean to be converted.
Examples:
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
Expression
Result
ToInteger( true )
1
ToInteger( false )
0
Description 4 of 8 (convert a date value):
Convert a date value to a whole number value.
The whole number represents the number of days since 1899/12/30. That is:
Date(
year, month, day
) = DaysAfter( Date(1899,12,30), ToInteger( Date(
year, month, day
) ) )
Returns:
Whole Number
Parameter:
Parameter
Data Type
Description
1
Date
The value to be converted.
Examples:
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
Expression
Result
ToInteger( Date( 1900, 1, 1 ) )
2
ToInteger( Date( 1900, 3, 1 ) )
61
ToInteger( Date(2000,2,29) )
36585
Description 5 of 8 (convert a list of text values):
Convert a list of text values to a list of whole number values.
If any of the text values correspond to a decimal number then it is rounded down (towards zero) to the nearest whole number.
Returns:
Whole Number*
Parameter:
Parameter
Data Type
Description
1
Text*
The list of text values to be converted.
Examples:
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
Expression
Result
ToInteger( List("2", "3", "4" )
List(2, 3, 4)
ToInteger( List("2.5", "3.1", "4.8"))
List(2, 3, 4)
ToInteger( "-2.5", "3.9", "356" )
List(-2, 3, 356)
Description 6 of 8 (convert a list of decimal number values):
Convert a list of numbers to a list of whole numbers by rounding down (towards zero) to the nearest whole number.
This function is equivalent to either:
  • RoundDown(
    value
    , 0 ), or
  • Floor(
    value
    , 1 ),
on each value in the list
Returns:
Whole Number*
Parameter:
Parameter
Data Type
Description
1
Number*
The list of numbers to be converted.
Examples:
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
Expression
Result
ToInteger( List(2, 3, 4) )
List(2, 3, 4)
ToInteger( List(2.5, 3.1, 4.8) )
List(2, 3, 4)
ToInteger( List(-2.5, 3.9, 356) )
List(-2, 3, 356)
Description 7 of 8 (convert a list of boolean values):
Convert a list of boolean values to a list of whole number values.
The boolean value
true
is converted to the number
1
and the boolean value
false
is converted to the number
0
.
Returns:
Whole Number*
Parameter:
Parameter
Data Type
Description
1
Boolean*
The list of boolean values to be converted.
Examples:
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
Expression
Result
ToInteger( List(true, false) )
List(1, 0)
ToInteger( List(false, true, true) )
List(0, 1, 1)
ToInteger( List(true, true, true) )
List(1, 1, 1)
Description 8 of 8 (convert a list of date values):
Convert a list of date values to a list of whole number values.
The whole number represents the number of days since 1899/12/30. That is:
Date(
year, month, day
) = DaysAfter( Date(1899,12,30), ToInteger( Date(
year, month, day
) ) )
Returns:
Whole Number*
Parameter:
Parameter
Data Type
Description
1
Date*
The list of date values to be converted.
Examples:
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
Expression
Result
ToInteger( List(Date( 1900, 1, 1 ), Date( 1900, 1, 2 ), Date( 1900, 1, 3 )) )
List(2, 3, 4)
ToInteger( List(Date( 1900, 3, 1 ), Date( 2011, 11, 11 )) )
List(61, 40858)
ToInteger( List(Date( 2000,2,29 ), Date( 1948, 06, 10 )) )
List(36585, 17694)