Monday, 4 February 2013

Microsoft Dynamics AX 2012 R2 - conLen Function

Retrieves the number of elements in a container.


  • int conLen(container container)


  • Parameter: container
  • Description: The container in which to count the number of elements.
The object parameter can be of most data types, but useful output is obtained when it is of the str or int type. Inappropriate content generates a run-time error.

Return Value

  • The number of elements in the container.


  • X++
static void conLenExample(Args _arg)
    container c;
    int i;

    c = conins(["item1", "item2"], 1);
    for (i = 1 ; i <= conLen(c) ; i++)
        print conPeek(c, i);

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - conLen Function' was informative. Please feel free to leave your comments.


  1. Thank you for the code.. I found your effort is welcome.. Keep posting.