用X++代码来动态的改变表的属性
static void ChangeTableProperties(Args _args)
{
xInfo xInfo = new xInfo();
treeNode node = xInfo.rootNode().AOTfindChild("Data Dictionary");
treeNode childNode;
treenodeIterator nodeIterator;
str properties;
str tables;
str newLable = "Change label";
;
node = node.AOTfindChild("Tables");
nodeIterator = node.AOTiterator();
childNode = nodeIterator.next();
while (childNode)
{
tables = childNode.treeNodeName();
if(tables == "AssetBook")
{
properties = setProperty(childNode.AOTgetProperties(), "Label", newLable);
info(properties);
childNode.AOTsetProperties(properties);
childNode.AOTsave();
childNode.AOTrefresh();
}
childNode = nodeIterator.next();
}
}
虽然这种用X++代码改变表属性的方法不值得提倡,但是这种方法可以用于一些特殊的场合。