ToInt
The ToInt function attempts to convert its input to an integer.
Syntax
ToInt ( value )
Remarks
The value parameter is the value to be converted. If the value is a floating point number, it will be truncated to an integer. If the value is a numeric string, it will be converted directly. For example, the string "5" will be converted to the integer 5. If the value is a date, it will be converted to the number of nanoseconds elapsed since midnight, January 1, 1990.
Examples
Example #1
The following example returns the number of seconds between the two most recent records in an event drive table:
StartAtOffsetFromNewest(2,OrderCollected);ToInt(Timestamp("Server:CR1000.Warn.AirTemp"-Last(Timestamp("Server:CR1000.Warn.AirTemp")))/nsecPerSec
Example #2
In the following example, PTemp is a floating point. This expression will truncate the value in PTemp to an integer (e.g., 23.58 would be truncated to 23):
ToInt("Server:CR1000.Public.PTemp")
Example #3
In the following example, MyString is a string variable. This expression will convert the string to a number, truncate that value to an integer, and then multiple the number by 2 (e.g., if MyString = "9.87654321", the expression will return 18):
ToInt("Server:CR1000.Public.MyString")*2
Example #4
In the following example, PTemp_TMn is the time of the minimum value for PTemp. This expression will return that timestamp as the number of nanoseconds since January 1, 1990.
ToInt("Server:CR1000.Test.PTemp_TMn")
Example #5
The following example will add one hour to the timestamp:
ToDate(ToInt(TimeStamp(Server:CR1000.one_sec.temp_degf)+nsecPerHour))