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)

Fill in only if you are not real





The following XHTML tags are allowed: <b>, <br/>, <em>, <i>, <strong>, <u>. CSS styles and Javascript are not permitted.
Posted by Arrowsol Training 2012-11-27 13:24

<a href="http://www.arrowsoltraining.com/microsoft-dynamics-crm/">Microsoft Dynamics CRM online training</a>

Posted by Studio Erudit team 2008-11-07 14:13

Thank you Alexander for another approach.

However, our intention was to show how it can be done through X++, since there are more complex scenarios where there is a need to update a property of an AOT object and etc., but the core structure is the same and therefore it can be used as a skeleton for more complex tasks.

Posted by Alex_KD 2008-11-07 08:58

Hi,
You can use standart Find dialog:
Choose \Data Dictionary\Tables node
Click right mouse button and choose "Find..."
In opened "Find..." dialog choose search method "All nodes"
In Property tab set range for property "SaveDataPerCompany" to "No" and check "selected" checkbox.
That all what you need.....

Best Regards,
Alexander
----
Utility for DAX developers(additional suggestions, hotkeys, etc) -
http://www.axassist.com