Add-ins to get the extended classes in DAX 2009

In AOT if you want to know for specific classes , what all child classes are extending this than have a look in following add-in .

Step1 : Create Job with following code.

static void TST_getExtendedClasses(Args _args)
{
    TreeNode        treeNode;
    SysDictClass    dictClass;
    List            extendedClassList;
    ListEnumerator  listEnumerator;
    SysContextMenu  contextMenu;
    Str             className, message;
    Counter         i;
    ;

    SysContextMenu::startedFrom(_args);

    contextMenu = _args.parmObject();
    treeNode    = contextMenu.first();


    i = contextMenu.selectionCount();

    if (treeNode.AOTparent().AOTname() == "Classes")  // Run only if it's opened from classes node
    {
        while (i >= 1)
        {

            dictClass           = new SysDictClass(className2Id(treeNode.AOTname()));
            extendedClassList   = dictClass.extendedBy();

            if (extendedClassList.elements())
            {
                listEnumerator = extendedClassList.getEnumerator();
                message = strfmt("Class %1 is extended by %2 subclasses.",treeNode.AOTname(),int2str(extendedClassList.elements()));
                setprefix(message);
                while (listEnumerator.moveNext())
                {
                    info(ClassId2Name(listEnumerator.current()));
                }

            }
            else
            {
                info(strfmt("Class %1 is not extended .",treeNode.AOTname()));
            }

            treeNode = contextMenu.next();
            i--;
        }
     }
}

Step2 : Create Menu Item with label as Get Extended classes and point to above job.

Step 3: Add above created menu item to the Menu 'SysContextMenu'.

Now if you do right click on class in AOT , than it should


When you select option Get Extended Classes , you will get the output as
Enjoyyy!!!!!!!!!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.