Developer Documentation Library > UNICOM Intelligence Function Library > Categorical functions > ContainsSome
 
ContainsSome
Identifies whether a category list contains some of the categories in a given list.
Syntax
ContainsSome(<value>, <answers> [, <minimum>] [, <maximum>] [, <exactly>])
Parameters
<value>
Type: Categorical
Categorical value.
<answers>
Type: None
Variant value of type Categorical or Text, specifying a set of categories to look for in <value>. If Answers is empty, the function returns True (unless Exactly is True and <value> is not empty).
<minimum>
Type: Long
(Optional.) The minimum number of categories in Answers that must be in <value> for the function to return True. If omitted, the minimum is one.
<maximum>
Type: Long
(Optional.) The maximum number of categories in Answers that must be in <value> for the function to return True. If omitted, the maximum is the number of categories in Answers.
<exactly>
Type: Boolean
(Optional.) If True, the function returns True only if <value> contains the specified number of categories and no others. If <exactly> is omitted or False, the function returns True if the specified number of categories in <answers> are in <value>, even if <value> contains other categories.
(return)
Type: Boolean
True if <value> contains the specified categories, otherwise False.
Notes
If the current value is NULL, <value> is an empty Categorical value ({}) and the return value is False. If <answers> is NULL, the return value is False.
Examples
Function call
Response
Filter
Result
ContainsSome(Response, Filter)
{2,4,6,10,11}
{1,2,3}
True
ContainsSome(Response, Filter, 1, 3, False)
{2,4,6,10,11}
{1,2,3}
True
ContainsSome(Response, Filter, 1, 3, True)
{2,4,6,10,11}
{1,2,3}
False
ContainsSome(Response, Filter, 1, 2, True)
{2,4,6,10,11,3,1}
{1,2,3}
False
ContainsSome(Response, Filter, 1, 3, True)
{1,2,3}
{1,2,3}
True
ContainsSome(Response, Filter, 1, 2, True)
{1,2,3}
{1,2,3}
False
Like ContainsAll and ContainsAny, ContainsSome is typically used to filter multiple response data. The Museum sample data set contains a multiple response variable called remember, which records the galleries that respondents remember viewing. You could use the following example to create a filter to select respondents who chose two or more of four specified categories in response to the question:
remember.ContainsSome({fossils, dinosaurs, birds, whales}, 2)
To restrict the filter to respondents who chose at least two, but not more than three, of the four categories, set Max to 3:
remember.ContainsSome({fossils, dinosaurs, birds, whales}, 2, 3)
To restrict the filter to respondents who chose at least two, but not more than three, of the four categories and no others, set Exactly to True:
remember.ContainsSome({fossils, dinosaurs, birds, whales}, 2, 3, True)
See also
ContainsAll
Categorical functions