≡ Menu

Dynamics Ax 2012 : Exploring the Containers

In Dynamics Ax there is structure known as containers. Here are some points for Containers

  • They are value based structure. So no class based object stored on it.
  • They are similar to linked list or array like structured.
  • Their size fixed at time of declaration. When you insert update or delete any value from container, a new container is created.
  • They always copied by value.
  • Containers are base 1 not like array based zero.

There is question arises why we use temporary tables when have containers . These containers which can stored almost very values data type value.  While there are lot of functions available for containers. Answer is that on temporary temple we can set indexes on fields and by this way we can fetch data much faster. Although data stored in container is sequentially but on insertion  a new copy is generated which is  performance over head. When data is increases in container, container starts to be heavy.  Similar when you passed temporary table to any method it passed by reference. But when we passed container to method, a new copy is generated and used in method. Container will used only when fewer values will be manipulated. In the case of larger set of data, we have to use temporary tables.


Declaration of containers.

container  firstContainer;

container  secondContainer = [3,"Ali","RAza"];


Read value from container.

The value from container can be read with conpeek function,  this method take two parameter, first one is container  and second parameter is for getting index. The conPeek function read value of any type so and read for any type.


_value  = conPeek(secondContainer,3);



Insert value:


There are two functions used for insert a value in container, conPoke and  conIns











There difference between conPoke and conIns is that conIns, insert a new value at location, and rest of value is shifted to one next Index. conPoke replace the value at insert location for example if


container  secondContainer = [3,”Ali”,”RAza”];
then conIns secondContainer=conIns(secondContainer,2,”Zaidi”);  will create new conainter like as


While conPok


will create a [3,”Zaidi”,”Ali”,”Raza”];






Removing the value from Container:



Condel function is used to remove the value from container.

secondContainer =conDel(secondContainer,2,1);

conNull function is used to clear all the value from container as

secondContainer=conNull() ;


Length of container is calculated as

int _lenght= conLen(secondContainer);



This method find the index the value which required to search, if value is not found zero will be return


_found =conFind(secondContainer,"RAza");


_found =conFind(secondContainer,"Abc");




Some important Global class functions for Container




This method return container values as comma sparated string.

_value = con2Str(secondContainer);



This function converts the container into list.

List _myList=con2List(secondContainer);



Loop through container:



Usually we have to loop through the container.



_lenght = conLen(secondContainer);

for (counter =1; counter <=_lenght; count++)









{ 0 comments… add one }

Leave a Comment