Skip to main content

Show all tables name and Total number of record of AOT in MSD axapta

To Show all tables name and Total number of record of AOT in axapta you can write following code in job . When you run the job you will get all tables with record count in info log.

 #AOT Name TableName;  
   NumberOf TotalRecord;  
   TrNode TrNode;  
   SysDictTable SysDictTab;  
   ;  
   TrNode = TrNode::findNode(#TablesPath);  
   TrNode = TrNode.AOTfirstChild();  
   while (TrNode)  
   {  
     TableName = TrNode.AOTname();  
     SysDictTab = SysDictTable::newTableId(TrNode.applObjectId());  
     TotalRecord = SysDictTab.recordCount(false);  
     if (TotalRecord)  
     info (strfmt("Table Name - Record count", TableName, TotalRecord));  
     TrNode = TrNode.AOTnextSibling();  
   }  

Popular posts from this blog

Set Mandatory fields in Table through code in MSD axapta

Set Mandatory fields in Table through code in ax

DictTable dictTable; DictField dictField; tableId tableId; fieldId fieldId; str result; #DictField ; dicttable = new DictTable(tablenum(salestable)); for (fieldId = dictTable.fieldNext(0);fieldId;fieldId = dictTable.fieldNext(fieldId)) { dictField = dictTable.fieldObject(fieldId); if (!dictField.isSystem() && bitTest(dictField.flags(), #dbf_visible) && bitTest(dictField.flags(), #dbf_mandatory)) { result += dictField.name(); result +='\n'; } } info(result);

Code to get all object of project node using MSD axapta

Code to get all object of project node using axapta


static void listAllObjectosFromProject(Args _args) { ProjName projName = "ListProjectNode_ABC"; ProjectListNode list = infolog.projectRootNode().AOTfindChild("Shared"); TreeNodeIterator ir = list.AOTiterator(); ProjectNode pnProj; ProjectNode pn = list.AOTfindChild(projName); void searchAllObj(projectNode rootNode) { #TreeNodeSysNodeType TreeNode childNode; TreeNodeIterator rootNodeIterator; ; if (rootNode) { rootNodeIterator = rootNode.AOTiterator(); childNode = rootNodeIterator.next(); while (childnode) { if (childNode.AOTgetNodeType() == #NT_PROJECT_GROUP) searchAllObj(childNode); else info(strfmt("Grupo:%1 - Objeto: %2", rootNode.AOTname(), childNode.AOTname())); childNode = rootNodeIterator.nex…