Extract data from container in dynamics ax

Description:-

In this Article we will see about container in ax. There are more functionality in container to do in ax it’s like array to store data in container and read it from container. A container can be stored in the database as a dataBasecoloumn created through AOT especially used to store images/files as a blob. For example assignment of a container to another container variable and container functions such as conIns(), conDel(), conPoke(), += etc. are actually creating a new copy of the container. Here is the demo Example of container in Ax.

conpeek:- Use conpeek to extract an item from a container, and to convert it into another data type, if necessary.

EX:- anytype conPeek(container container, int number)

static void main(Args _args)
{
    container cnI, cnJ;
    int i, j;
    anytype aty;
   
    
    info("container cnI ...");
    cnI = ["itemBlue", "itemYellow"];
   
    for (i=1; i <= conLen(cnI); i++)  
    {
        aty = conPeek(cnI, i);
        info(int2str(i) + " :  " + aty);
    }
 
    //OR
   
    info("container cnJ ...");
    cnJ = conIns(cnI, 2, "ItemInserted");
   
    for (j=1; j <= conLen(cnJ); j++) 
    {
        aty = conPeek(cnJ, j);
        info(int2str(j) + " :  " + aty);
    }
}

Related Posts

Previous
Next Post »

Thanks for comments.....