Info |
---|
|
This routine is available starting with SIL Engineā¢ 1.0. Table plus |
---|
applyColStyleToCell | true |
---|
heading | 0 |
---|
columnTypes | s,s,s,s |
---|
multiple | false |
---|
columnAttributes | style="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold, |
---|
enableSorting | false |
---|
|
Syntax | arrayAddElementIfNotExist(arrayName, elem) | Package | array | |
...
Alias | addElementIfNotExist(arrayName, elem) | Pkg Usage | addElementIfNotExist( |
|
...
Description
Excerpt |
---|
|
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. |
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)
ParametersParameters
Table plus |
---|
applyColStyleToCell | true |
---|
columnTypes | s,s,s,s |
---|
heading | 0 |
---|
multiple | false |
---|
enableSorting | false |
---|
|
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
arrayArray
Examples
Example
...
1
Code Block |
---|
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
Code Block |
---|
watchers = addElementIfNotExist(watchers, currentUser());
|
The initial array will be modified as a result of the = operator and NOT of the routine call.
Notes
Note |
---|
- 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
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 10025 |
---|
showSpace | false |
---|
cql | label = "array_routines" and space = currentSpace ( ) |
---|
labels | array_routines |
---|
|