count() Operation
Syntax |
NONE
| |
---|---|---|
Semantics | Counts the number of elements in anArray . The count operation returns an Integer value. The count of an empty array is zero. | |
Substitutables | anArray | Can be any variable or object attribute having the type Array. |
Examples |
NONE
|
Example File (Builder project E2E Action Language/Array):
<your example path>\E2E Action Language\Array\uml\arrayCount.xml |
Figure below shows an example of counting the elements of the array myList
that is an attribute of class InputContainer. The array elements are of type String. The output is of base type Integer named nrOfElements.
Figure: count() Example
The count()
operation can also be used in conditions of decision points:
Figure: Example of Operation count() in a Condition
In the figure above, the flow branches depending on the number of array elements in array myArray
. If the array contains at least one element, the flow branches to the action node create message for non-empty myArray
.