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.
This function is non-evaluable if the text value does not correspond to a number.
1 | Text | The text to be converted. |
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
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:
1 | Number | The number to be converted. |
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
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
.
1 | Boolean | The boolean to be converted. |
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
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
) ) )
1 | Date | The value to be converted. |
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
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.
This function is non-evaluable if any of the text values do not correspond to a number.
1 | Text* | The list of text values to be converted. |
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
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
on each value in the list
1 | Number* | The list of numbers to be converted. |
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
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
.
1 | Boolean* | The list of boolean values to be converted. |
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
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
) ) )
1 | Date* | The list of date values to be converted. |
When using functions inside a field, remember the field brackets:
{ToInteger(VariableName)}
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) |