AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.01.2014, 15:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
Pawan's Ax blog: Compare objects among 2 or more layers in Ax2012
Источник: http://pawansaxblog.blogspot.com/201...re-layers.html
==============



Sometime we might like to find objects existing in two or more layers i.e. layer 1 AND layer 2. Out of box we have a feature of creating a project for objects present in specific layers i.e. layer 1 OR layer 2.
So with below job you can build on this standard feature thereby finding common objects i.e. objects present in all(AND condition) the specified layers only.




Note : If you try to iterate whole AOT thru code it becomes performance intensive hence not advisable to do it. So always create one project and then further work on it.


static voidlistAllObjectosFromProject(Args _args)
{


ProjName projName = "CompilerOutput"; // Specify your project area name here


ProjectListNode list = infolog.projectRootNode().AOTfindChild("Shared");


TreeNodeIterator ir = list.AOTiterator();
ProjectNode pnProj,projectNode;
ProjectNode pn = list.AOTfindChild(projName);
SetEnumerator setEnumerator;
Set set;
container layers;
#define.ProjectName("Compileroutput_Sub") // Sub project Name. You may like to change it as per you like.




voidsearchAllObj(projectNode rootNode)
{
#TreeNodeSysNodeType


TreeNode childNode;
TreeNodeIterator rootNodeIterator;
;


projectNode = SysTreeNode::getPrivateProject().AOTfindChild(#ProjectName);
if(!projectNode)
{
projectNode = SysTreeNode::createProject(#ProjectName,ProjectSharedPrivate::ProjPrivate);
}


if(rootNode)
{
rootNodeIterator = rootNode.AOTiterator();
childNode = rootNodeIterator.next();
while (childnode)
{


if (childNode.treeNodeType().id() == #NT_PROJECT_GROUP)
searchAllObj(childNode);


else
{
//info(strfmt("Group :%1 - Object: %2", rootNode.AOTname(), childNode.AOTname()));
set = childNode.AOTLayers(false);


setEnumerator = set.getEnumerator();
layers = conNull();


while(setEnumerator.moveNext())
{
layers = layers +enum2Symbol(enumName2Id('UtilEntryLevel'),setEnumerator.current());


}


if(confind(layers,'syp') && confind(layers,'usr')) // Put your layers here in which you want to check objects
{




info(strFmt('Name: %1, Layers: %2', childNode.AOTname(),con2Str(layers) ));


projectNode.addNode(childNode);
projectNode.AOTsave();


}




}
childNode = rootNodeIterator.next();
}
}
}










if (pn)
{
info(strFmt("Project %1:", projName));
pnProj = pn.loadForInspection();
searchAllObj(pnProj);
pnproj.treeNodeRelease();
}
else
info("Projet objects");

}


Источник: http://pawansaxblog.blogspot.com/201...re-layers.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
atinkerersnotebook: Walkthrough & Tutorial Summary Blog bot DAX Blogs 1 09.09.2013 09:11
amer-ax: It was a great day! Blog bot DAX Blogs 3 29.12.2012 01:02
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 19:35.