Today I received a request from one of our consultants, who needed an overview of tables in AX 2012 belonging to the “Transactions” tablegroup.
So I made this little job, that loops through elements in the AOT, and retrieves the table properties, and then lists tables with tablegroup “Transactions”:
static void GIT_LoopTablesInAOT(Args _args)
{
#AOT
Treenode tableNode;
Treenode table;
Form actualTable;
str TableGroup;
str tableName;
str tblGroup;
int i;
int nodeCount;
;
tableNode = treenode::findNode(#TablesPath);
// Count of all the forms.
nodeCount = tableNode.AOTchildNodeCount();
table = tableNode.AOTfirstChild();
//for (i=1; i<=nodeCount; ++i)
for (i=1; i<=100; ++i)
{
tableName = table.AOTgetProperty("Name");
actualTable = tableNode.AOTfindChild(tableName);
tblGroup = actualTable.AOTgetProperty('TableGroup');
if (tblGroup == 'Transaction')
info(strFmt("%1 - %2, %3", tableName, tblGroup, actualTable.usageCount()));
table = table.AOTnextSibling();
}
}
