Conversion Functions
The functions listed in the table below are for SQL queries and should not be used with inline scripts.
The following table lists the conversion functions used in Logi Info:
BOOLEAN_TO_STR(boolean)
|
Converts a boolean value to a string. Each data sources stores boolean values using different types. Some use integers, others use bit, and a few actually have a boolean type. Because of these type issues, the function code for each system expects sightly different values. In order to test this function or any of the boolean functions, please use a boolean field. e.g. BOOLEAN_TO_STR([Invoiced]) returns 'true' if Invoiced is true.
|
DATE_TO_UNIXTIME(datetime_value)
|
Converts a date time value into a unix timestamp. e.g. DATE_TO_UNIXTIME([OrderDate]) returns an integer like 1231451515
|
INT_TO_DATETIME(integer)
|
Converts a numeric integer value to date time value. e.g. INT_TO_DATETIME(1231451515) returns 2009-01-08 21:51:55
|
STR_TO_DATETIME(string)
|
Converts a string representation of a date value to date time value. String must be ISO8601 format. e.g. STR_TO_DATETIME('2015-04-30T22:45:33')
|
STR_TO_LONG(string)
|
Converts string value to long value (64bit integer). e.g. STR_TO_LONG('723874928') returns 723874928
|
STR_TO_DECIMAL(string)
|
Converts string value to decimal value. e.g. STR_TO_DECIMAL('10.53') returns 10.53
|
STR_TO_BOOLEAN(string)
|
Converts string value to boolean value. e.g. STR_TO_BOOLEAN('true') depending on internal boolean type of system it could be a 1 or true
|
TO_STRING(any)
|
Converts value to string value. e.g. TO_STRING(20) will be converted to '20'
|