How to get table name and number of records in each table in AOT in Ax 2012

Description:-

To find out the name of each table in AOT along with the number of records for each table.

static void FindTableandRecords(Args _args)
{
     #AOT Name name;
     NumberOf recordCount;
     TreeNode treeNode;
     SysDictTable sysDictTable;
     ;
     treeNode = TreeNode::findNode(#TablesPath);
     treeNode = treeNode.AOTfirstChild();
     while (treeNode)
     {
         name = treeNode.AOTname();
         sysDictTable = SysDictTable::newTableId(treeNode.applObjectId());
         recordCount = sysDictTable.recordCount(false);
         if (recordCount)
         info (strfmt("@SYS26868", name, recordCount));
         treeNode = treeNode.AOTnextSibling();
     }
}

Results:

Related Posts

Thanks for comments.....

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer