zoukankan      html  css  js  c++  java
  • A quick look at lists and creat to XML

    This is just a quick look at the List object in Dynamics AX. Just played around with it to see what functionality was there and what wasn’t. As you can see I just created a simple list of integers and also one with records from InventTable, if you wan’t to know what types can be placed in the list, check out the baseEnum "Types” in the AOT.

    As a bonus I also created a xml file of the list of integers.

    remark by Jimmy on May 26th 2011

    static void Jimmy_ListsXML(Args _args)
    {
    List il, il2;
    ListEnumerator listEnum, listEnum2;
    AsciiIo file;
    str filePath;
    InventTable invent;
    ;
    /*-----Add List (int)------*/
    il
    = new List(Types::Integer);
    // Add some elements to the list
    il.addEnd(1);
    il.addEnd(
    2);
    il.addStart(
    3);
    print
    "List ----------";
    // Print a description of the list
    print il.elements();
    print il.definitionString();
    print il.toString();
    // Print List as xml.
    print il.xml();

    /*-----List to XML------*/

    // Create an xml file of the list.
    filePath = "C:\\temp\\list.xml";
    file
    = new AsciiIo(filePath, "W");
    file.write (il.xml());
    // Get enumerator
    listEnum = il.getEnumerator();
    print
    "Enumerator ----";
    print listEnum.definitionString();
    // Loop through enumerator
    while (listEnum.moveNext())
    {
    print listEnum.toString();
    // Print value as String.
    print listEnum.current();// Print value as anyType.
    }

    /*-----add list (records)------*/

    // Now a list with records.
    il2 = new List(Types::Record);
    while select invent
    where invent.ItemId == "10-1000" ||
    invent.ItemId
    == "10-1003"
    {
    il2.addEnd(invent);
    }
    // Get enumerator
    listEnum2 = il2.getEnumerator();
    invent
    = null;
    // Get records and print values.
    while (listEnum2.moveNext())
    {
    invent
    = listEnum2.current();
    print
    "New record...";
    print invent.RecId;
    print invent.ItemId;
    }
    pause;
    }
  • 相关阅读:
    Poj 2104 K-th Number(主席树&&整体二分)
    Bzoj 3262: 陌上花开(CDQ分治)
    Bzoj 2683: 简单题(CDQ分治)
    ZOJ2314 Reactor Cooling(无源汇上下界可行流)
    Cogs 12. 运输问题2(有上下界的有源汇最大流)
    Cogs 461. [网络流24题] 餐巾(费用流)
    Codevs 1227 方格取数 2(费用流)
    Cogs 13. 运输问题4(费用流)
    Poj 2195 Going Home(费用流)
    开学第二测
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2057962.html
Copyright © 2011-2022 走看看