Mar 19, 2019

How to extract the object list from project in X++

ProjectListNode             _ProjectListNode   = infolog.projectRootNode().AOTfindChild("Private");
ProjectNode                 _ProjectNode = _ProjectListNode.AOTfindChild("Your project name");
PBU_ProjectManagementTmp    _ProjectManagementTmp;
str                         _ObjectPath = "";
str                         _ObjectType = "";

void searchAllObj(projectNode _rootNode)
{
#TreeNodeSysNodeType
TreeNode          _childNode;
TreeNodeIterator  _rootNodeIterator;

if (_rootNode)
{
_rootNodeIterator = _rootNode.AOTiterator();
_childNode        = _rootNodeIterator.next();

while (_childnode)
{
if (_childNode.treeNodeType().id() == #NT_PROJECT_GROUP)
{
searchAllObj(_childNode);
}
else
{
/*
//Path
_childNode.treeNodePath();

//Object type (AOT)
PBU_ProjectHelper::Get_ProjectObjectNameViaPath(subStr(strReplace(_childNode.treeNodePath(),_childNode.AOTname(),""),1,strLen(strReplace(_childNode.treeNodePath(),_childNode.AOTname(),""))-1));

//Object name (AOT)
_childNode.AOTname();
*/
}

_childNode = _rootNodeIterator.next();
}
}
}

if (_ProjectNode)
{
searchAllObj(_ProjectNode.loadForInspection());
}

No comments:

Post a Comment