Find All AOT Object Layers

Sometimes you might need to know the total objects on different layers in AOT.

The below job that I wrote will show all the tables exist on different layers you can copy and paste it to excel from the data in the infolog after the job has been executed.

In order to know about the other objects than the tables just change “#TablesPath” macro which are available in #AOT.

static void displayAOTObjLayers(Args _args)

{

#AOT

#Properties

#define.LayerCount(16)

str                     layers;

str                     aotObjName;

int                     i, j, objectLayers;

str                     total;

TreeNode        treeNode, treeNodeInLayer;

Array               layerArray;

DictEnum        dictEnum;

UtilElements   utilElements;

TreeNode        baseTreeNode;

;

layerArray = new Array(Types::String);

dictEnum = new DictEnum(enumNum(UtilEntryLevel));

//#TablesPath is the path of tables in AOT. Look other object paths in #AOT macro.

baseTreeNode = TreeNode::findNode(#TablesPath);

treeNode = BaseTreeNode.AOTfirstChild();

while(treeNode)

{

for (i = 0; i < dictEnum.values(); i++)

{

layerArray.value(i+1, dictEnum.value2Name(i));

}

objectLayers = treeNode.applObjectLayerMask();

for (i = 0; i < #LayerCount; i++)

{

j = objectLayers;

j = j & power(2, i);

 

if (j)

{

aotObjName = TreeNode.AOTname();

layers += layerArray.value(i + 1)+’ ‘;

}

}

info(strfmt(‘%1 || %2′, aotObjName, layers));

treeNode = treeNode.AOTnextSibling();

aotObjName = ”;

layers = ”;

}

}

About the author

: Taimoor is a senior software engineer in Systems Limited. He has a vast experience working with Dynamics AX2012R2, AX2009 and AX4.0. He does things like AX development and customization, client support, upgrading, integration, installation and configuration, debugging and performance enhancement. He is also experienced in working with different clients based in different regions. Other than this, he likes to play and watch cricket and hang out.

Leave a Comment

Name (required)
Email (required)
Comment (required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>