/
arrayAddElementIfNotExist
arrayAddElementIfNotExist
Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center? Click here !
Availability
This routine is available starting with SIL Engine™ 1.0.
Syntax
arrayAddElementIfNotExist(arrayName, elem)
Description
If elem is an element of the array type, returns a new array that includes the specified element at the end. The element is added only if it is not already in the array.Alias
addElementIfNotExist(arrayName, elem)
Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
arrayName | array | Yes | Array the new element is added to. |
elem | any | Yes | Element to be added. Must be the same type as the array type. |
Return Type
array
Example
example 1
watchers2 = addElementIfNotExist(watchers, currentUser());
Adds currentUser to the watchers array if currentUser is not already present. The routine returns a new array watchers2, so the initial array will not be modified.
example 2
watchers = addElementIfNotExist(watchers, currentUser());
The initial array will be modified as a result of the = operator and NOT of the routine call.
Notes
- If arrayName is not defined as an array, the routine returns error.
- If elem is not the same type as declared in the array definition, the routine returns error.
See also
Related content
arrayStructSort
arrayStructSort
Read with this
arrayAddElement
arrayAddElement
More like this
subarray
subarray
Read with this
arrayAddElementIfNotExist
arrayAddElementIfNotExist
More like this
arrayFind
arrayFind
Read with this
arrayAddElementIfNotExist
arrayAddElementIfNotExist
More like this