Scripting > UNICOM Intelligence Function Library > Conversion functions > CText
 
CText
Converts a value of any data type to a Text value.
Syntax
CText(Val)
Parameters
Val
Type: None
Variant value to be converted.
(return)
Type: Text
Text representation of Val.
Remarks
This function is similar to CStr in Visual Basic.
The result of the conversion depends on the data type of Val, as follows:
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 ("").
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