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)
Output:
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:
No comments:
Post a Comment