To find unused EDT’s in your Dynamics Ax application, the following code will sscan through the crossreference and display the EDT’s on screen.
Note, you will have to compile your application with crossreference turned on, otherwise you may get all your EDT’s as not used
//True if used private boolean FindEDTUsed(extendedTypeId _id, str 40 name) { XRefNames xRefName; boolean ret = true; ; //select firstonly xRefName where xRefName.kind == xRefKind::ExtendedType; select firstonly xRefName where xRefName.kind == xRefkind::ExtendedType && (xRefName.name == name); //|| xRefName.typeName == name); if(xRefName.RecId) ret = true; else ret = false; return ret; } public void run() { Dictionary dict = new Dictionary(); int types; int i; int first = true; Set unusedEDT; ; unusedEDT = new Set(Types::Integer); //Find list of EDT types = dict.typeCnt(); info(dict.typeName(dict.typeCnt2Id(1))); /*for(i = 11; i <= 20; i++) { info(dict.typeName(dict.typeCnt2Id(i))); info(strfmt("%1 %2", dict.typeCnt2Id(i), "")); }*/ for(i = 1; i <= types; i++) { //process each type if(!this.FindEDTUsed(dict.typeCnt2Id(i), dict.typeName(dict.typeCnt2Id(i)))) { if(first == true) { info('Unused EDT List'); first = false; } //unusedEDT.add(dict.typeCnt2Id(i)); //store it in a set for later use info(dict.typeName(dict.typeCnt2Id(i))); } } }
Filed under: Ax 2009, Dynamics Ax, X++
