Monday, February 7, 2011

How to use TreeNode to navigate objects in the AOT

During a code merge into an environment managed by another company, I came across some tables with "UNKNOWN" delete actions in their production environment.  This worried me a little bit, so I whipped up a quick job to search every table for unknown delete actions to see what the real damage was.  This demonstrates how to use TreeNode to traverse the AOT.  The reason I used "subStr" for a portion of the code was I also searched for "DEL_" delete actions.

static void findTablesWithSpecificDeleteAction(Args _args)
    TreeNode    rootNode;
    TreeNode    childNode;
    TreeNode    tempNode;
    rootNode = infolog.findNode(#TablesPath).AOTfirstChild();
    while (rootNode)
        childNode = rootNode.AOTfindChild('DeleteActions');
        if (childNode)
            tempNode = childNode.AOTfirstChild();
            while (tempNode)
                if (subStr(tempNode.AOTname(), 1, 3) == "UNK")
                tempNode = tempNode.AOTnextSibling();
        rootNode = rootNode.AOTnextSibling();

1 comment:

  1. If you don’t completely trust online assistants, then you need to read the tips for choosing the best resume writing service on this site so that you don’t make a mistake with the choice and you won’t regret it for sure