Microsoft Dynamics AX FAQ

Microsoft Dynamics AX FAQ

How to find an AOT object by its property?

X++Posted by Studio Erudit team 2008-11-06 23:28

The X++ job below shows how to find all tables in the AOT where the SaveDataPerCompany property is set to No.

static void se_findAOTObjectByProperty(Args _args)
{
#AOT

TreeNode treeNodeTables = TreeNode::findNode(#TablesPath);
TreeNode treeNode;
str strPropertyName = 'SaveDataPerCompany';
str strPropertyValue = 'No';
;

// first table
treeNode = treeNodeTables.AOTfirstChild();

while (treeNode != null)
{
if (treeNode.AOTgetProperty(strPropertyName)== strPropertyValue)
{
info(treeNode.AOTname());
}

// next table
treeNode = treeNode.AOTnextSibling();
}
}

  • Comments(3)//daxfaq.studioerudit.com/#post9