Scripting > UNICOM Intelligence Function Library > Categorical functions > ContainsSome
 
ContainsSome
Identifies whether a category list contains some of the categories in a given list.
Syntax
ContainsSome(Val, Answers [, Min] [, Max] [, Exactly])
Parameters
Val
Type: Categorical
Categorical value.
Answers
Type: None
Variant value of type Categorical or Text, specifying a set of categories to look for in Val. If Answers is empty, the function returns True (unless Exactly is True and Val is not empty).
Min
Type: Long
Optional. The minimum number of categories in Answers that must be in Val for the function to return True. If omitted, the minimum is one.
Max
Type: Long
Optional. The maximum number of categories in Answers that must be in Val 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 Val 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 Val, even if Val contains other categories.
(return)
Type: Boolean
True if Val contains the specified categories, otherwise False.
Remarks
If the current value is NULL, Val 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