Friday, July 6, 2018

Cross Company

By default, select statements in X++ adhere to the DataAreaId structure of the
application. For example, if there are two company accounts, 001 and 002, a
select statement run in company 002 will only return records stamped with
dataAreaId equal to 002. The
crossCompany keyword allows the statement to
fetch records regardless of the dataAreaId. The following example shows a
statement that will count all customer records from all company accounts.



1
2
select crossCompany count(recId) from custTable;
countCustTable = custTable.recId;

You also 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. The following example illustrates the use of the
crossCompanykeyword.


1
2
3
4
5
6
7
8
CustTable custTable;
container conCompanies = [ '001', '002', 'dat' ];

while select crosscompany : conCompanies * from custTable
order by dataAreaId
{
  //do something
}

Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...