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();
}
}
Welcome to Solutions for AX DEV — a dedicated space for developers and consultants working with Microsoft Dynamics AX / D365 F&O (D365 F&O). This blog contains a collection of frequently used code snippets, development tips, and practical solutions related to AX (Axapta). Whether you're working with X++, you'll find helpful content tailored to your development needs. Have a question or need help with something Feel free to post your it.
Subscribe to:
Posts (Atom)
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...
-
It is very common to use Like Operator in SQL SELECT column1, column2, ... FROM table_name WHERE columnN LIKE pattern ; N...
-
In the below example we will see how we can get the default financial dimension values from Purch line table. Here we are using AxdDimensi...
-
Get temp data from class to form Data source AX 2012 + X++ In the below example we will see how we can use the temporary table as form da...