Monday, April 1, 2013

Cycle through container in AX

The below code shows how to cycle though a container in X++ for AX 2012.

Yes I know that the below can be done different. I'm doing things a certain way out of concept and writing it on a plane without a compiler. Also, you could use an array instead of a container since this is a single data type but I'm trying to show containers, not arrays.

I would suggest not using conIns for inserting elements at the end of the container as these inserts seem to get slower the larger the container being inserted into becomes. That's why I use the '+=' seen below.

    int         i;
    CustTrans   custTrans;
    container   custTransCont;    

    // Build the container with data
    while select custTrans
       where custTrans.AccountNum == 'CUS00001141'
       // The += is faster than the conIns() function
       //custTransCont = conIns(custTransCont, i, custTrans.RecId);
       custTransCont += custTrans.RecId;

    // Cycle (iterate) through the container
    for (i=1; i <= conlen(custTransCont); i++)
       info(strFmt("%1 - CustTrans RecId: %2", i, conpeek(custTransCont, i)));


  1. Exact2pass Aruba Certified Mobility Expert 8 exam is complete study material also includes real HPE6-A48 Exam questionanswers that will help our end users to prepare for the HPE Aruba Certified HPE6-A48 exam.

  2. Nobody wants to fail at achieving their dreams and if you are troubled by HP ACMX and are looking for solutions! I would be more than happy to share my secret. I passed the test in just one attempt using HPE6-A48 Practice Test Questions Answers I found at reasonable cost at Grades4sure. I am sure using these HPE6-A48 Exam Question Answers you can accomplish your goals too. What’s better is these Free HPE6-A48 Question Answers follow the same pattern as in exam.

  3. Pass your HPE6-A48 Aruba Certified Mobility Expert 8 exam easily in first attempt by the help of latest HP HPE6-A48 questions with valid answers. Braindumps4IT provide HPE Aruba Certified HPE6-A48 braindumps guaranteed success. We have updated HPE6-A48 practice test questions and providing with HP HPE Aruba Certified exam passing assurance.