Developer Documentation Library > UNICOM Intelligence Function Library > Conversion functions > CText
 
CText
Converts a value of any data type to a Text value.
Syntax
CText(<value>)
Parameters
<value>
Type: None
Variant value to be converted.
(return)
Type: Text
Text representation of <value>.
Notes
This function is similar to CStr in Visual Basic. The result of the conversion depends on the data type of <value>, as follows:
Boolean: The return value is “True” or “False” or their locale equivalents.
Categorical: The string is of the form "{1,2,0}", where the numbers are the values of the categories in <value> (formatted using digits only, ignoring the locale).
Date: The string contains the date formatted according to the locale.
Long or Double: The string contains the number formatted according to the locale.
NULL values: If <value> is NULL, the return value is an empty string ("").
Object: If the object has a default property, the value of that property is converted. Otherwise an error occurs.
Text: <value> is returned unchanged.
Examples
Data type
Value
Result
Categorical
{4,7}
{4,7}
Boolean
6
True
Long
345
345
Double
6004.67
6004.67
Date
14 April 2001
14/04/2001
For an mrScriptBasic example of using CText, see Example 1: More than one response to a single response question.
See also
CBoolean
Conversion functions