CrossCompany and changeCompany using x++.
CrossCompany:
Required company filter:
MyTable myTable;
container conCompanies = ['cmp1', 'cmp2', 'cmp3'];
while select crossCompany : conCompanies * from myTable
{
// code
}
All company filter:
MyTable myTable;
while select crossCompany * from myTable
{
// code
}
Applying On Dynamic queries:
Query query = new Query();
QueryRun queryRun;
QueryBuildDataSource qBDS;
qBDS = query.addDataSource(TableNum(CustTable));
// Way-1 (we can add required company)
query.allowCrossCompany(true);
query.addCompanyRange('cmp1');
query.addCompanyRange('cmp2');
// Way-2 (It will loop all company)
queryRun = new QueryRun(query);
queryRun.allowCrossCompany(true);
Change Company:
MyTable myTable;
changeCompany('cmp1')
{
while select myTable
{
// code
}
}
Comments
Post a Comment