Scripting > 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(Val, CategorizedVariable)
Note The categories must be created before the Categorize function can be used. The function does not create categories.
Parameters
Val
Type: None
Variant value of type Long, Double, Text, or Date
CategorizedVariable
Type: Text
The name of the categorical variable, which will be used to ensure the generated category name exists.
(return)
Type: None
The converted categorical value related to Val.
Remarks
The conversion is based on the definition of the categorical variable named in the CategorizedVariable parameter. The conversion process starts by generating an MDM name from the value Val. 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. Refer to the ICoding topic in the UNICOM Intelligence Developer Documentation Library for more information.
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