could anyone help optimize this code? I'm new in X++, so don't expect
much from this...
What this does it exports all objects in the "usr" layer to files in
the C:\TEMP dir. The main idea is to collect this from different
servers and check for diferences, so I know what needs to be updated
at each server.
Tanks
static void Job1(Args _args)
{
ProjectNode MainProjectNode;
ProjectNode ProjectNode;
ProjectNode SubProjectNode;
ProjectNode MainFather;
ProjectNode Father;
ProjectNode SubFather;
ProjectNode MainChild;
ProjectNode Child;
ProjectNode SubChild;
TreeNode usrLayer;
TreeNodeIterator MainIterator;
TreeNodeIterator Iterator;
TreeNodeIterator SubIterator;
str ObjectProperties;
str ObjectType;
;
MainProjectNode = infolog.rootNode();
MainFather = MainProjectNode;
MainProjectNode = MainProjectNode.AOTfirstChild();
MainIterator = MainFather.AOTiterator();
MainChild = MainIterator.next();
while(MainChild)
{
if(MainChild.AOTchildNodeCount() > 0)
{
Father = MainChild;
Iterator = Father.AOTiterator();
Child = Iterator.next();
While(Child)
{
if(Child.AOTchildNodeCount() > 0)
{
ObjectProperties = Child.AOTgetProperties();
if(ObjectProperties != "")
{
usrLayer = Child.getNodeInLayer( UtilEntryLevel::usr);
if(usrLayer)
{
ObjectType = usrLayer.AOTtypeStr();
usrLayer.treeNodeExport('C:\\temp\\' + Mainchild.AOTname() +
'-' + child.AOTname() + '_' + ObjectType + '.xpo',1); // Subbu, pls
appened the content
}
}
else
{
SubFather = Child;
SubIterator = SubFather.AOTiterator();
SubChild = SubIterator.next();
While(SubChild)
{
if(SubChild.AOTchildNodeCount() > 0)
{
ObjectProperties = SubChild.AOTgetProperties();
if(ObjectProperties != "")
{
usrLayer = SubChild.getNodeInLayer( UtilEntryLevel::usr);
if(usrLayer)
{
ObjectType = usrLayer.AOTtypeStr();
usrLayer.treeNodeExport('C:\\temp\\' + Mainchild.AOTname() +
'-' + child.AOTname() + '-' + SubChild.AOTname() + '_' + ObjectType +
'.xpo',1); // Subbu, pls appened the content
}
}
}
else
{
usrLayer = Child.getNodeInLayer( UtilEntryLevel::usr);
if(usrLayer)
{
ObjectType = usrLayer.AOTtypeStr();
usrLayer.treeNodeExport('C:\\temp\\' + Mainchild.AOTname() +
'-' + child.AOTname() + '-' + SubChild.AOTname() + '_' + ObjectType +
'.xpo',1); // Subbu, pls appened the content
}
}
SubChild = SubIterator.next();
}
}
}
else
{
usrLayer = Child.getNodeInLayer( UtilEntryLevel::usr);
if(usrLayer)
{
ObjectType = usrLayer.AOTtypeStr();
usrLayer.treeNodeExport('C:\\temp\\' + Mainchild.AOTname() + '-'
+ child.AOTname() + '_' + ObjectType + '.xpo',1); // Subbu, pls
appened the content
}
}
Child = Iterator.next();
}
}
else
{
usrLayer = MainChild.getNodeInLayer( UtilEntryLevel::usr);
if(usrLayer)
{
ObjectType = usrLayer.AOTtypeStr();
usrLayer.treeNodeExport('C:\\temp\\' + child.treeNodePath() + '-'
+ child.AOTname() + '_' + ObjectType + '.xpo',1); // Subbu, pls
appened the content
}
}
MainChild = MainIterator.next();
}
}
SPONSORED LINKS
| Computer part | Programming languages | Microsoft axapta |
| Support exchange |
YAHOO! GROUPS LINKS
- Visit your group "development-axapta" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

