Developer Documentation Library > UNICOM Intelligence Function Library > Conversion functions > CBoolean
 
CBoolean
Converts a value of any data type to a Boolean value.
Syntax
CBoolean(<value>)
Parameters
<value>
Type: None
Variant value to be converted.
(return)
Type: Boolean
Boolean value derived from <value>.
Notes
This function is similar to CBool in Visual Basic.
The result of the conversion depends on the data type of <value>, as follows:
Boolean: <value> is returned unchanged.
Categorical: The conversion results in a value of False if the categorical value is empty {} and a value of True for all other categorical values.
Date: If <value> is 30 December 1899 00:00:00, the return value is False, otherwise it is True.
Long or Double: If <value> is zero, the return value is False, otherwise it is True.
NULL values: If <value> is NULL, the return value is False.
Object: If the object has a default property, the value of that property is converted. Otherwise an error occurs.
Text: The string is parsed according to the locale to extract the value. An error occurs if the string does not contain a recognizable Boolean value (numeric, or a string representing True or False).
Examples
Data type
Value
Result
Long
133
True
Long
0
False
Double
4.5
True
Date
30 December 1899 00:00:00
False
Date
14 April 2001 4:14:06
True
Text
24 St John's Road, Barnes
Error
Text
0
False
Text
true
True
Categorical
{}
False
Categorical
{Whales}
True
See also
CCategorical
Conversion functions