Tuesday, 5 April 2016

How to find specific EDT in Tables using X++ Code

static void Raj_findEdtinTable(Args _args)
{

    treeNode childNode;
    treeNode fields;
    treenodeIterator it, itFld;

    str properties;
    str table;
    str field;
    str extendedDataType;
    str searchType = "PurchInternalInvoiceId";     // EDT
    int x;
    treeNode t  = TreeNode::findNode('\\Data Dictionary\\Tables');
    ;

    it = t.AOTiterator();
    childNode= it.next();
    while (childNode)
    {
      Table = childNode.treeNodeName();
      itFld = t.AOTfindChild(childNode.treeNodeName()).AOTfindChild("Fields").AOTiterator();

      fields = itFld.next();
      while (fields)
      {
        field = fields.treeNodeName();
        properties = fields.AOTgetProperties();
        extendedDataType = findProperty(properties, "ExtendedDataType");

        if (extendedDataType == searchType)
        {
          info(strfmt("%1 / %2 – ExtendedDataType: %3", table, field, extendedDataType));
        }
        fields = itFld.next();
      }
      childNode= it.next();
    }

}

No comments:

Post a Comment