Monday, 9 July 2012

Tree node to Excel file

static void CreateExcelMallik(Args _args)


{



SysExcelApplication xlsApplication;

SysExcelWorkBooks xlsWorkBookCollection;

SysExcelWorkBook xlsWorkBook;

SysExcelWorkSheets xlsWorkSheetCollection;

SysExcelWorkSheet xlsWorkSheet;

SysExcelRange xlsRange;

AsciiIO tmpfile;

Filename tmpfilename;

FileIOPermission permission;

TreeNode treeNode;

TreeNode treeNodeTables;

#File

#AOT

int row = 1;

str fileName;

;



treeNodeTables = TreeNode::findNode(#SecurityKeysPath);



// Name of the Excel document.



fileName = "C:\\test.xsl";



// Excel open and initialize.



xlsApplication = SysExcelApplication::construct();

xlsApplication.visible(true); //Generate new Excel worksheet.

xlsWorkBookCollection = xlsApplication.workbooks();

xlsWorkBook = xlsWorkBookCollection.add();

xlsWorkSheetCollection = xlsWorkBook.worksheets();

xlsWorkSheet = xlsWorkSheetCollection.itemFromNum(1);

// Write headlines cells in the worksheet.

xlsWorkSheet.cells().item(row,1).value('Name'); xlsWorkSheet.cells().item(row,2).value('ID');

row++;

// first table

treeNode = treeNodeTables.AOTfirstChild();

// Excel worksheet with fill data (Excel fill-cells).

while (treeNode != null)

{

xlsWorkSheet.cells().item(row,1).value(treeNode.AOTname()); xlsWorkSheet.cells().item(row,2).value(treeNode.applObjectId());

row++; // next table

treeNode = treeNode.AOTnextSibling();

}

// Check whether the document already exists.

if(WinApi::fileExists(fileName))

{

WinApi::deleteFile(fileName);

}

// Excel document store.

xlsWorkbook.saveAs(fileName);

//Close Excel.

xlsApplication.quit(); xlsApplication.finalize();

}

Tree Node for Security Key and write to text file.

static void TextFile_TreeNood_Demo(Args _args)


{

AsciiIO tmpfile;

Filename tmpfilename;

FileIOPermission permission;

#File

#AOT

TreeNode treeNode;

TreeNode treeNodeTables = TreeNode::findNode(#SecurityKeysPath);

tmpfilename = WinApi::getTempFilename(WinAPI::getTempPath(),'SecurityKey');

permission = new FileIOPermission(tmpfilename,#IO_write);

permission.assert();

tmpfile = new AsciiIO(tmpfilename, #IO_write);

if(tmpfile.status()==IO_Status::Ok)

{

tmpfile.outRecordDelimiter('\n');

tmpfile.outFieldDelimiter(';');

}

else

{

return;

}



while (treeNode != null)

{

tmpfile.write(strfmt('Name: %1, ID: %2',treeNode.AOTname(), treeNode.applObjectId())); /

}

tmpfile = null;

CodeAccessPermission::revertAssert();

}

AIF Test JOB

static void AIFTesting(Args _args) { AifGatewayReceiveService AifGatewayReceiveService; AifInboundProcessingService AifInboundProcessingService; ; AifGatewayReceiveService = new AifGatewayReceiveService(); AifInboundProcessingService = new AifInboundProcessingService(); AifGatewayReceiveService.run(); AifInboundProcessingService.run(); //ttsabort; }

Sunday, 8 July 2012

Table Tuning (to check this if all tables have Primary,Cluster Index and Caching.

//This Script will check if all tables have // //Primary index //Cluster index //Caching ////NOTE: temp tables are skipped static void TableTuningTest_Mallik(Args _args) { boolean skipEmptyTables = true; boolean result; treeNode treeNode; SysDictTable sdt; str TableAndCound; int recordCount; boolean skipEmptyrecordCount = false; treeNodeIterator treeNodeIterator =TreeNode::findNode("\\Data Dictionary\\Tables").AOTiterator(); ; treeNode = treeNodeIterator.next(); setPrefix("Tuning"); while (treeNode) { sdt = new SysDictTable(tablename2id(treeNode.AOTname())); recordCount = sdt.recordCount(); if(!sdt.isTmp() && (!skipEmptyTables || (recordCount != 0)) ) { TableAndCound = treeNode.AOTname()+ ' ('+ int2str(sdt.recordCount())+')'; setPrefix(TableAndCound); result = false; result = result || sdt.treeNode().AOTgetProperty("CreatedDateTime") == "yes" ? true : false; result = result || sdt.treeNode().AOTgetProperty("ModifiedDateTime")== "yes" ? true : false; if(result && sdt.treeNode().AOTgetProperty("CreateRecIdIndex") == "No" ) { setPrefix(TableAndCound); info("RecIdIndex"); } if(sdt.treeNode().AOTgetProperty("CacheLookup") == "None") { setPrefix(TableAndCound); info("CacheLookup"); } if(sdt.treeNode().AOTgetProperty("ClusterIndex") == "") { setPrefix(TableAndCound); Warning("ClusterIndex"); } if(sdt.treeNode().AOTgetProperty("PrimaryIndex") == "") { setPrefix(TableAndCound); Error("PrimaryIndex"); } } treeNode = treeNodeIterator.next(); } }

AX Job to export Security Key to CSV file.

static void AOTGetProperty(Args _args) { #aot #properties Boolean writeFile; Boolean infoDebug; CommaIo outFile; TreeNode tn = TreeNode::findNode(#SecurityKeysPath); str securityKeysName; str securityKeyID, Property; int sID; str errMsg; ; infoDebug = false; // ***OPTION*** View InfoLog Output (true / false) writeFile = true; // ***OPTION*** Export results to CSV file (true / false) errMsg = ""; //"--- NOT DEFINED ---"; //C:\Users\m.a.gudidevuni\Documents outFile = new AsciiIo("C:\\GTA\\SecurityKey.CSV","W"); outFile.outFieldDelimiter("\r\n"); outFile.outRecordDelimiter("\r"); tn = tn.AOTfirstChild(); while (tn) { securityKeysName = findProperty(tn.AOTgetProperties(), #PropertyName); securityKeyID = findProperty(tn.AOTgetProperties(),#PropertyId); sID = tn.applObjectId(); if(infoDebug) { info(strfmt('SecurityKeysName %1 with ID : %2',securityKeysName,sID)); } if(writeFile) { outFile.write(securityKeysName + " , " + strReplace(int2str(sID),",","")); } // info(strfmt('SecurityKeysName %1 with ID : %2',securityKeysName,sID)); // Property = tn.AOTgetProperties(); // info(strfmt('%1', findProperty(Property, 'ID'))); // info (strfmt( // 'SecurityKeysName %1 has the ID property specified as %2', // securityKeysName, securityKeyID)); tn = tn.AOTnextSibling(); } }

Monday, 13 September 2010

Job to Create N # companys and import data.

Job to Create N number of companys and import the data in it.

static void CreateCompanies_Rajiv(Args _args)
{
DataArea dataarea;
counter i;
CompanyDomainList companyDomainList;
CompanyDomainList cCompanyDomainList;
sysdataImport sysDataimport;
Application gappl = new Application();
filename filename;
;
filename = "D:\\MyShare\\Data\\5.0SP1\\ExtendedData\\40ExtendedData1380";

for(i=1 ; i<301 ; i++)
{
DataArea.clear();
DataArea.Id = 'C' + int2str(i);
DataArea.name = 'Company' + int2str(i);
DataArea.insert();
xDataArea::insertPost(dataArea);

while select * from companyDomainList where companyDomainList.CompanyId == DataArea.Id
{
select firstonly cCompanyDomainList
where cCompanyDomainList.CompanyId == DataArea.Id &&
cCompanyDomainList.DomainId == companyDomainList.DomainId;

if (!cCompanyDomainList)
{
cCompanyDomainList.data(companyDomainList.data());
cCompanyDomainList.CompanyId = DataArea.Id;
cCompanyDomainList.insert();
}

//create the default company
gappl.setDefaultCompany(DataArea.Id,false);
syssecurity::reload(false);
InfoLog.navPane().loadStartupButtons();
Infolog.navPane().refreshFavorites(infolog.navPane().selectedFavoriteGroup(),xInfo::currentWorkspaceNum());

sysDataImport = new sysDataImport();
sysDataImport.parmDropCompany(true);
sysdataimport.parmDeleteTables(connull());
sysDataImport.parmSilent(true);
sysdataImport.parmFilename(filename);
sysDataImport.parmServerAccess(Noyes::Yes);
sysdataImport.run(false);
//sysDataImport::importFile("D:\\MyShare\\Data\\5.0SP1\\ExtendedData\\40ExtendedData1380.dat",FileType::Binary);
}

if(i==14 || i==25 || i==40 || i==60 || i==75 || i== 90 || i== 110 || i== 130 ||
i==150 || i==170 || i==190 || i==220 || i==240 || i==270)
infolog.clearBrowser();

}
}

Monday, 15 June 2009

Build numbers

Build numbers

Here the Axapta build numbers,

Client versions
Build number Version AOCP version
1951.8 3.0 N/A
1951.17 3.0 SP1 60029 (0xEA7D)
1951.18 3.0 SP1 N/A
1951.2410 3.0 SP2 60031 (0xEA7F)
1951.2411 3.0 SP2 Hotfixed 60031 (0xEA7F)
1951.3730 3.0 SP3 60031 (0xEA7F)
1951.3733 3.0 SP3 Hotfixed 60031 (0xEA7F)
1951.4060 3.0 SP4 60031 (0xEA7F)
1951.5160 3.0 SP5 61031 (0xEE67)
1951.6710 3.0 Kernel Rollup 1 61031 (0xEE67)
1951.7500 3.0 Kernel Rollup 2 63031 (0xF637)
1951.7609 3.0 Kernel Rollup 3 63031 (0xF637)
Application versions
Build number Version
514-90 3.0 SP2
514-193 3.0 SP3
514-320 3.0 SP4
514-513 3.0 SP5
514-859 3.0 SP6
Dynamics AX Version 4.0
Build number Version AOCP version
4.0.1659.26 4.0 RTM 41638 (0xA2A6)
4.0.1659.35 4.0 RTM (localized) N/A
4.0.2163.0 4.0 SP1 42060 (0xA44C)
4.0.2500.XXX 4.0 SP1 DIS layer hotfixes 42060 (0xA44C)
4.0.2501.116 4.0 SP2 42060 (0xA44C)
4.0.2503.XXX 4.0 SP2 DIS layer hotfixes 42060 (0xA44C)

[edit] Dynamics Ax 2009
Build number Version
5.0.593.0 2009 RTM
5.0.1000.52 2009 SP1

[edit] See also

How to Disable “Advanced Filter or Sort” and Enforce Custom Filters on Any D365FO Form

 In Dynamics 365 Finance and Operations, users can apply filters through the “Advanced filter or sort” feature found under the Options tab...