• Skip to main content
  • Skip to primary sidebar
  • Home
  • About
  • Recommended Readings
    • 2022 Book Reading
    • 2023 Recommended Readings
    • Book Reading 2024
    • Book Reading 2025
  • Supply Chain Management Guide
  • PKM
  • Microsoft Excel
  • Microsoft Copilot in Office 365
  • Public Wiki Page

Ali Raza Zaidi

A practitioner’s musings on Dynamics 365 Finance and Operations

Dynamics Ax 2012 : Exploring the Containers

February 10, 2013 by alirazazaidi

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

 

ConIns

 


secondContainer=conIns(secondContainer,2,"Zaidi");

 

 

conPoke:

 

secondContainer=conpoke(secondContainer,2,”test");

 

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

[3,”Zaidi”,”Ali”,”Raza”];

While conPok

secondContainer=conpoke(secondContainer,2,”test”);

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

 

[3,”test”,”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);

confind:

 

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

 

_found =conFind(secondContainer,"RAza");

info(int2str(_found));

_found =conFind(secondContainer,"Abc");

 

 

 

Some important Global class functions for Container

 

 

Con2Str:

This method return container values as comma sparated string.

_value = con2Str(secondContainer);

 

Con2List:

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++)

{

_value=conPeek(secondContainer,counter);

info(_value);

}

 

 

 

 



Filed Under: Dynamics AX 2012 Tagged With: Dynamics Ax 2012, X++

Primary Sidebar

About

I am Dynamics AX/365 Finance and Operations consultant with years of implementation experience. I has helped several businesses implement and succeed with Dynamics AX/365 Finance and Operations. The goal of this website is to share insights, tips, and tricks to help end users and IT professionals.

Legal

Content published on this website are opinions, insights, tips, and tricks we have gained from years of Dynamics consulting and may not represent the opinions or views of any current or past employer. Any changes to an ERP system should be thoroughly tested before implementation.

Categories

  • Accounts Payable (2)
  • Advance Warehouse (2)
  • Asset Management (3)
  • Azure Functions (1)
  • Books (6)
  • Certification Guide (3)
  • Customization Tips for D365 for Finance and Operations (62)
  • D365OF (60)
  • Data Management (1)
  • database restore (1)
  • Dynamics 365 (59)
  • Dynamics 365 for finance and operations (138)
  • Dynamics 365 for Operations (174)
  • Dynamics AX (AX 7) (134)
  • Dynamics AX 2012 (274)
  • Dynamics Ax 2012 Forms (13)
  • Dynamics Ax 2012 functional side (16)
  • Dynamics Ax 2012 Reporting SSRS Reports. (31)
  • Dynamics Ax 2012 Technical Side (52)
  • Dynamics Ax 7 (65)
  • Exam MB-330: Microsoft Dynamics 365 Supply Chain Management (7)
  • Excel Addin (1)
  • Favorites (12)
  • Financial Modules (6)
  • Functional (8)
  • General Journal (1)
  • Implementations (1)
  • Ledger (1)
  • Lifecycle Services (1)
  • Logseq (4)
  • Management Reporter (1)
  • Microsoft Excel (4)
  • MS Dynamics Ax 7 (64)
  • MVP summit (1)
  • MVP summit 2016 (1)
  • New Dynamics Ax (19)
  • Non Defined (9)
  • Note taking Apps (2)
  • Obsidian (4)
  • Personal Knowledge Management (3)
  • PKM (16)
  • Power Platform (6)
  • Procurement (5)
  • procurement and sourcing (6)
  • Product Information Management (4)
  • Product Management (6)
  • Production Control D365 for Finance and Operations (10)
  • Sale Order Process (10)
  • Sale Order Processing (10)
  • Sales and Distribution (5)
  • Soft Skill (1)
  • Supply Chain Management D365 F&O (4)
  • Tips and tricks (278)
  • Uncategorized (165)
  • Upgrade (1)
  • Web Cast (7)
  • White papers (4)
  • X++ (10)

Wiki

  • SCM

Copyright © 2026 · Magazine Pro On Genesis Framework · WordPress · Log in