Monday, 4 February 2013

Microsoft Dynamics AX 2012 R2 - conIns Function

Inserts one or more elements into a container.


  • container conIns (container container, int start, anytype element, ... )


  • Parameter: container
  • Description: The container into which to insert elements.
  • Parameter: start
  • Description: The position at which to insert elements.
  • Parameter: element
  • Description: One or more elements to insert, separated by commas.

The first element of the container is specified by the number 1. To insert after the n element, the start parameter should be n+1.

You can also use the += operator to add values of any type into a container. For example, to create a container that contains the squared values of the first 10 loop iterations:

  • X++
int i;
container c;

for (i = 1; i < = 10; i++)
    c += i*i;

Return Value

  • The new container with the inserted elements.


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

    c = conIns(c,1,"item1");
    c = conIns(c,2,"item2");
    for (i = 1 ; i <= conLen(c) ; i++)
    // Prints the content of a container.
        print conPeek(c, i);


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

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

No comments:

Post a Comment