≡ Menu

Little bit taste of List In Dynamics Ax 2012

In Dynamics Ax List is used as collection, You can add , remove or update elements in it. Type of list is define at the time of its declaration and cannot be change after initialization.

We can iterate in List with the help of ListIterator object, which have several methods to process on list.

 List           intList       = new List(Types::Integer);
    List           strList = new List(Types::String);
    ListIterator   literator  

    // add the element at the end of the list

    // add the element at the start of the list


    strList.addEnd ("Raza");

    strList.addStart ("Ali"); 

    strList.addStart ("Zaidi"); 

    // If you want to insert the data at some specific index, then you need to make use of the listIterator class 

    // Iterator performs a midpoint 

    // insert at current position. 

    literator = new ListIterator(strList);
    while (literator.more())
        // can provide some condition, i.e. if check etc
        if (literator.value() == "Ali")
            listIterator.insert ("Between Raza and Zaidi");

{ 0 comments… add one }

Leave a Comment