Developer Documentation Library > UNICOM Intelligence Function Library > Miscellaneous functions > Categorize
 
Categorize
Converts the value of a Numeric, Text, or Date value to a Categorical value according to the definition of the specified categorical variable.
Syntax
Categorize(<value>, <variable>)
The categories must be created before the Categorize function can be used. The function does not create categories.
Parameters
<value>
Type: None
Variant value of type Long, Double, Text, or Date
<variable>
Type: Text
The name of the categorical variable, which is used to ensure the generated category name exists.
(return)
Type: None
The converted categorical value related to <value>.
Notes
The conversion is based on the definition of the categorical variable named in the <variable> parameter. The conversion process starts by generating an MDM name from the value <value>. The MDMName function is used for this process. When a generated category name does not exist in the specified categorical variable, the ‘Other’ category is returned (if it exists), otherwise the empty categorical,{}, is returned.
If the value is Null or an empty string, ‘NA’ is returned (if it exists) on the specified variable, otherwise NULL is returned.
When a Table Document is available, the ICoding object can be used to create categorized variable. For more information, see ICoding in the UNICOM Intelligence Developer Documentation Library.
Example
_Queue "Sample queue"
  categorical [1..1]
    {
      FRESH "Fresh",
      ACTIVE "Active",
      TIMEDOUT "Timed Out",
      NA "No Answer" na,
      other "Other" other
    };
The following result is returned:
Result = Categorize(Val, "_Queue")
Val
Result
"Active"
{ACTIVE}
" "
{NA}
"NoAnswer"
{other}
See also
Miscellaneous functions