Breadcrumbs

count() Operation


Syntax


anArray.count()


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


set size = anArray.count();




icon_download_example.png

<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

count.png

The count() operation can also be used in conditions of decision points:

Figure: Example of Operation count() in a Condition

countcondition.png

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.