Anitha's profileAnitha's spaceBlogNetwork Tools Help

Anitha's space

Anitha

July 30

Tree Node and TreeNodeTraverse Classes

Being my first blog entry, I would like to dedicate this to my lovable husband Santosh.
 
Here is a simple job to list the tables available in Ax using TreeNode Class.
 
static void TreeNodeEgs(Args _args)
{
    #AOT
    TreeNode              treeNode;
    TreeNode              treeNodeTbl;
    TreeNodeTraverser TNT ;
 
    ;
     
    treeNode      = TreeNode::findNode(#TablesPath); // Initialise the Path. Here the node is pointing to Tables

    treeNode      = treeNode.AOTfirstChild(); // Comment this code when u try TreeNodeTraverser
 
    while(treeNode) // Print the list of tables in AOT
    {
       
info(strfmt(treeNode.AOTname()));
       treeNode = treeNode.AOTnextSibling();
    }
 
     
    // Traversing the Nodes in  Customer Table using TreeNodeTraverser
 
   //  treeNodeTbl = treeNode.AOTfindChild('CustTable');
   //  TNT           = new TreeNodeTraverser(treeNodeTbl);

   //  while(TNT.next())
   //  {
   //       info(strfmt(TNT.currentNode().toString()));  // List of child nodes in CustTable including fields,fieldgroups
   //   }
}
 
On executing this job, you can find all table names. Simple..Isn`t?? Smile
 
To try TreeNodeTraverser,uncomment the statements in the above job and execute it. 
 
Will come back soon with more simple entries.
Happy DAxing..