Friday, May 25, 2012

Code for Traverse between Tables and all the fields

With reference of Bineet's blog here I found the code for Traverse between tables and all the fields.


//Travese between tables and for each table traverse between all the fields
static void TeeNode_traverse(Args _args)
{
    TreeNode            treeNode, treeNodeTable;
    TreeNodeIterator    iterator;
    void traverseFields(TreeNode _treeNode)
    {
        TreeNode parentNode;
        parentNode = _treeNode.AOTfindChild(‘Fields’);
        //treeNodeTable = _treeNode.AOTfirstChild();
        iterator = parentNode.AOTiterator();
        parentNode = iterator.next();
        while(parentNode)
        {
            //treeNodeTable = treeNodeTable.AOTfirstChild();
            parentNode = iterator.next();
        }
    }
    ;
    treeNode = TreeNode::rootNode();
    treeNode = treeNode.AOTfirstChild();
    treeNodeTable = treeNode.AOTfindChild(‘Tables’);
    treeNodeTable = treeNodeTable.AOTfirstChild();
    while(treeNodeTable)
    {
        traverseFields(treeNodeTable);
        treeNodeTable = treeNodeTable.AOTnextSibling();
    }
}