Scripting > UNICOM Intelligence Function Library > Conversion functions > CBoolean
 
CBoolean
Converts a value of any data type to a Boolean value.
Syntax
CBoolean(Val)
Parameters
Val
Type: None
Variant value to be converted.
(return)
Type: Boolean
Boolean value derived from Val.
Remarks
This function is similar to CBool in Visual Basic.
The result of the conversion depends on the data type of Val, as follows:
Boolean
Val is returned unchanged.
Long or Double
If Val is zero, the return value is False, otherwise it is True.
Date
If Val is 30 December 1899 00:00:00, the return value is False, otherwise it is True.
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).
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.
Object
If the object has a default property, the value of that property is converted. Otherwise an error occurs.
NULL values
If Val is NULL, the return value is 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