Search code examples
axaptadynamics-ax-2009x++

AOT Reflection not working as expected?


I'm writing some code to search the AOT for certain objects and just doing an Extended Data Type search isn't working as expected. I created, in the USR layer, an EDT called "Alex" with an EnumType of "SysDimension". It can't find it in the AOT, but it can find others.

static void Job6(Args _args)
{
    #AOT
    TreeNodeIterator    treeNodeIterator;
    TreeNode            treeNode;
    SysDictEnum         sysDictEnum;
    ;

    treeNodeIterator    = TreeNode::findNode(#ExtendedDataTypesPath).AOTiterator();
    treeNode            = treeNodeIterator.next();
    while (treeNode)
    {
        sysDictEnum         = new SysDictEnum(treeNode.applObjectId());

        if (sysDictEnum)
        {
            if (sysDictEnum.name() == "Alex")
                info("Found Alex"); // WHY ISN'T THIS FOUND?

            if (sysDictEnum.name() == "ABCModel")
                info("Found ABCModel"); // THIS IS OUTPUT
        }

        treeNode = treeNodeIterator.next();
    }

    info("Done");
}

Solution

  • Ah I feel stupid. I was iterating over the Extended Data Types but using sysDictEnum instead of sysDictType, which is for EDTs. Explains my confusing results.