Survey Tabulation > Advanced expressions > UNICOM Intelligence function library > Conversion functions > CText
 
CText
Converts a value of any data type to a Text value.
Syntax
CText(Val)
Parameter
Val
Type: None
Variant value to be converted.
(return)
Type: Text
Text representation of Val.
Remarks
The result of the conversion depends on the data type of Val, as follows:
Data type
Result
Boolean
The return value is "True" or "False" or their locale equivalents.
Long or Double
The string contains the number formatted according to the locale.
Date
The string contains the date formatted according to the locale.
Text
Val is returned unchanged.
Categorical
The string is of the form "{1,2,0}", where the numbers are the values of the categories in Val (formatted using digits only, ignoring the locale).
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 an empty string ("").
This function is similar to CStr in Visual Basic.
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
Conversion functions