Understanding ConLen() Function in Container in X++
☰Fullscreen
Table of Content:
- The conLen() is used to retrieve the number of elements in a container.
- Syntax: int conLen(container container)
- container - The container in which to count the number of elements.
- Return value: The number of elements in the container.
Example:
Code:
static void Container_conLenExample(Args _args) { // container declaration and initialization with 2 values container containerName = ["Welcome", 1202, "good"]; str charHolder; ; // conLen() function returns the number of elements in the container // Here at this instance we have 2 elements [] info(strFmt("containerName conLen() container length is :- %1", conLen(containerName))); }
Output:
The above code will produce the following result-
containerName conLen() container length is :- 3