Developer Documentation Library > UNICOM Intelligence Function Library > Categorical functions > XUnion
 
XUnion
Returns the exclusive union of two category lists--that is, it returns all of the categories that are in either one of the category lists, but not in both.
Syntax
XUnion(<value>, <answers>)
Parameters
<value>
Type: Categorical
Categorical value.
<answers>
Type: None
Variant value of type Categorical or Text, specifying a set of categories.
(return)
Type: Categorical
Set of categories that are in either <value> or Answers but not in both.
Notes
If the current value is NULL, <value> is an empty Categorical value ({}) and the return value is <answers>. If <answers> is NULL, the return value is <value>.
This function is equivalent to the Division (/) operator for Categorical values, except that it can operate on named categories and the NULL behavior is different. However, using the / operator is generally faster than using the XUnion function.
Examples
Function call
Q1
Q2
Result
XUnion(Q1, Q2)
{3,5,9,10,23,5,6}
{5,16,4,10}
{3,9,23,6,16,4}
Q1.XUnion(Q2)
{3,5,9,}
{5,3,9}
{}
Like the Difference and Intersection functions, XUnion is useful when categorical variables have identical or overlapping category lists. For example the biology and education variables have identical response lists. In the following example, XUnion is used to return any categories that are in either one of the category lists, but not in both, and the >= operator tests whether the result contains the Yes category. For example, you could use this expression to select respondents who chose the Yes category in response to either one of the questions, but not to both.
XUnion(biology, education) >= {yes}
See also
Categorical functions