Q: How to get cross company data in Axapta?
You can get multiple company data
by using cross-company query on the X++ select statement. You have the option of
adding a container variable of company identifiers immediately after the crossCompany keyword (separated by a colon). The
container restricts the selected rows to those with a dataAreaId that
match a value in the container.
Syntax:
· Select crosscompany: from
Example:
static void JobDemoCrossCompany(Args _args)
{
BankAccountTable tabBAT;
// saveDataPerCompany == true.
container conCompanies =
[ 'cm1', 'cm2', 'dat' ];
str 4 sCompanyPrevious =
" "; // Maximum length is 4 characters.
int iCountCompanies = 0;
;
while select
crossCompany
: conCompanies
* from tabBAT
order by dataAreaId
{
if (
sCompanyPrevious != tabBAT.dataAreaId )
{
info(
tabBAT.dataAreaId + " = tabBAT.dataAreaId" );
iCountCompanies++;
if (
iCountCompanies >= 2 )
{
break;
}
sCompanyPrevious
= tabBAT.dataAreaId;
}
}
return;
}
No comments:
Post a Comment