Search This Blog

Wednesday, December 21, 2011

Search un-used EDT'S using X++

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
            && ( == name);

    ret = true;
   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();

  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;
       //store it in a set for later use

1 comment:

Thanks for visiting my blog,
I will reply for your comment within 48 hours.