最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

Looking for EDTs with broken table relations

网络文摘 William 1733浏览 0评论
The other day I found a couple of EDTs with broken table relations and wrote a script that found even more EDTs with the same problem.

Broken relations look like this:


static void findBrokenRelationsInEDTs(Args _args)
{
#AOT
#TreeNodeSysNodeType
 
TreeNodeIterator iterator;
TreeNode edtTreeNode;
TreeNode relationsNode;
TreeNode relationNode;
;
 
iterator = TreeNode::findNode(#ExtendedDataTypesPath).AOTiterator();
if (iterator == null)
{
throw error("Cannot create tree node iterator");
}
 
edtTreeNode = iterator.next();
 
while (edtTreeNode != null)
{
relationsNode = edtTreeNode.AOTfindChild('Relations');
 
if (relationsNode.AOTchildNodeCount() == 0
|| edtTreeNode.AOTname() like "DEL_*")
{
edtTreeNode = iterator.next();
continue;
}
 
relationNode = relationsNode.AOTfirstChild();
 
while (relationNode != null)
{
if (relationNode.sysNodeType() == #NT_DBTYPENORMALREFERENCE
&& (relationNode.AOTgetProperty('Table') == ''
|| relationNode.AOTgetProperty('RelatedField') == ''))
{
error(edtTreeNode.AOTname());
break;
}
 
relationNode = relationNode.AOTnextSibling();
}
 
edtTreeNode = iterator.next();
}
}

Output:


发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址