Important

   

This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 22.1 for BMC Helix Operations Management. Open link

subset()

Verify that one PSL list is a subset of another.

Syntax

subset(set,subset)

Parameter

ParameterDefinition

set

PSL list that is the set in the set-subset verification

subset

PSL list that is the subset in the set-subset verification

Description

The subset() function returns a Boolean value of 0 or 1 indicating whether subset is a proper or improper subset of set. Ifsubset is the NULL set, the subset() function returns 1 (TRUE). If set is the NULL set and subset is not, the subset() function returns 0 (FALSE). 

The subset() function ignores duplicates and returns 1 only if all elements of subset are also present in set.

Example

The subset() function can be used to determine whether a particular element is present in a set and thus provides "is_member" functionality such as the following:

my_set = ["red", "green","blue","orange", "yellow", "violet"];
sub = ["green", "blue"];
if(subset(my_set,"blue"))
{
print("This is a subset");
}
if(subset(my_set,sub))
{
print("This is a subset also");
}


It is not necessary to place a new line at the end of the "blue" string because it is inserted by the subset() function. The example statements are treated as a subset() function acting on a set with one element.

Was this page helpful? Yes No Submitting... Thank you

Comments