During X++ development I think finding a EDT with a specific String Size is a huge problem. Initially we are trying to find but after we create a new one EDT. For this reason .aod size is increasing day to day to some extend. I listed down a job which helps you to find out proper String EDT by giving our String Length value. A list will come into excel in your PC.
static void Raj_EDTfind(Args _args)
{
Dictionary dict;
DictType dictType;
TreeNode treeNode = TreeNode::findNode("Data Dictionary\\Extended Data Types\\ABCModelType");
#AviFiles
sysExcelApplication excel;
SysExcelWorkbooks books;
SysExcelWorkbook book;
SysExcelWorkSheets sheets;
SysExcelWorkSheet sheet;
com com;
Integer row = 2;
Dialog d = new Dialog("Input Box");
DialogField dfStrValue;
Integer tmpStringLen = 0;
SysOperationProgress progress = new SysOperationProgress();
;
// Dialog initialised and accept value and asign
dfStrValue = d.addField(typeId(Integer),"Enter EDT String Length");
if(!d.run())
return;
tmpStringLen = dfStrValue.value();
if(!tmpStringLen)
throw error("Plaese Enter Valid Number.");
// Excel Object initialisations
excel = sysExcelApplication::construct();
books = excel.workbooks();
book = books.add();
sheets = excel.worksheets();
sheet = sheets.itemFromNum(1);
com = sheet.comObject();
// Heading Initialisations
sheet.cells().item(2,1).value("EDT Name");
sheet.cells().item(2,5).value("Label");
// Progress Bar Initialisations
progress.setCaption("Generating Lines");
progress.setAnimation(#AviTransfer);
progress.setTotal(500);
// loop for searching EDTs
while(treeNode)
{
dict = new Dictionary();
dictType = dict.typeObject(dict.typeName2Id(treeNode.treeNodeName()));
if(dictType.stringLen() == tmpStringLen)
{
row++;
sheet.cells().item(row,1).value(treeNode.treeNodeName());
sheet.cells().item(row,5).value(dictType.label());
progress.setText(strfmt('Copying EDT %1.', treeNode.treeNodeName()));
progress.setCount(row);
}
treeNode = treeNode.AOTnextSibling();
}
sheet.cells().item(1,1).value(strfmt("Found EDT: %1.", row)); // Count & Print for Filtered EDT
box::info(strfmt("Total EDT Found: %1.", row), "Information");
excel.visible(true);
}
No comments:
Post a Comment