Set functions perform various functions on values for multi-assign attributes, such as obtaining the size of the set, checking whether a set is empty, or converting an attribute from a multi-value to a single-value attribute.
This table describes the Set functions that Transform supports. The same functions are described in the Transform API Reference (Groovydoc).
| User Function | Return Data Type | Description | 
|---|---|---|
| cardinality(Object attribute) | Long | Inputs the set of values in a multi-assign attribute and obtains the size of that set. Works only on multi-value (multi-assign) attributes. Throws an exception if run on a single-assign attribute. | 
| isEmpty(Object attribute) | Boolean | Inputs the set of values in a multi-assign attribute and checks whether this set is empty (has no assignments). Returns trueif the set is empty.Works only on multi-value (multi-assign) attributes. Throws an exception if run on a single-assign attribute. | 
| isMemberOf(Object attribute, Object value) | Boolean | Checks whether the value belongs to the set of values in a multi-assign attribute. Returns trueif the value belongs to the set.Works only on multi-value (multi-assign) attributes. Throws an exception if run on a single-assign attribute. | 
| isNull(Object attribute) | Boolean | Determines whether an attribute has any assigned values. Returns trueif the attribute is null (has no assigned values). Works on both multi-assign and single-assign attributes. | 
| isSet(Object attribute) | Boolean | Checks if an attribute is a multi-assign attribute. Returns trueif yes.Works only on multi-value (multi-assign) attributes. Throws an exception if run on a single-assign attribute. | 
| toSet(Object... attributes) | Object[] | Converts an Object argument list to an Object array. Works only on multi-value (multi-assign) attributes. Throws an exception if run on a single-assign attribute. | 
| toSingle(Object attribute) | Object | Converts a multi-value attribute into a single-value attribute. Returns a single value chosen randomly from a set of values for the attribute. Works only on multi-value (multi-assign) attributes. Throws an exception if run on a single-assign attribute. |