Developer Documentation Library > UNICOM Intelligence Function Library > Conversion functions > CCategorical
 
CCategorical
Converts a value of any data type to a Categorical value.
Syntax
CCategorical(<value>)
Parameters
<value>
Type: None
Variant value to be converted.
(return)
Type: Categorical
Categorical value derived from <value>.
Notes
There is no equivalent function in Visual Basic.
The result of the conversion depends on the data type of <value>, as follows:
Long: The return value contains a single category whose value is <value>.
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. Note that <value> 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: <value> 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 <value> is NULL, the return value is an empty Categorical value ({}).
Examples
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}
Text1
{dinosaurs,birds,mammals}
{31,35,38}
Text
24
{24}
Text
Some text
Error
1 This example assumes that the museum sample MDM document is available to the function.
See also
CBoolean
Conversion functions