Survey Tabulation > Advanced expressions > UNICOM Intelligence function library > Conversion functions > CCategorical
 
CCategorical
Converts a value of any data type to a Categorical value.
Syntax
CCategorical(Val)
Parameters
Val
Type: None
Variant value to be converted.
(return)
Type: Categorical
Categorical value derived from Val.
Remarks
The result of the conversion depends on the data type of Val, as follows:
Data type
Result
Long
The return value contains a single category whose value is Val.
Text
The function parses the string as a comma-separated list of either category values or names. Category values must be of the form "{1,2,0}", and the return value contains each listed value, in the order given. Category names must be of the form "{married,single,widowed,other}", which the function will convert to a list of category values. You can omit the braces if the value to be converted is a single category value or name. Val cannot consist of a category expression.
The conversion of category names to values is possible only when the case data is opened with an MDM document, or when a script has an open MDM document available to it. For more information about opening a MDM document in a script, see Value resolution.
Categorical
Val is returned unchanged.
Double, Date, or Boolean
An error occurs.
Object
If the object has a default property, the value of that property is converted. Otherwise an error occurs.
NULL value
If Val is NULL, the return value is an empty Categorical value ({}).
There is no equivalent function in Visual Basic.
Examples
These examples assume that the museum sample MDM document is available to the function.
Data type
Value
Result
Boolean
True
Error
Categorical
{2,8,9,3,1}
{2,8,9,3,1}
Long
459
{459}
Text
{3,6,8}
{3,6,8}
Text
{dinosaurs,birds,mammals}
{31,35,38}
Text
24
{24}
Text
Some text
Error
See also
Conversion functions