This report example will help you to get the data from selected companies or all companies using AllowCrossCompany property
In the AOT, query node objects have the AllowCrossCompany property listed in the Properties window. For new queries the default value is No (which is equivalent to false in X++ code). To make a query cross-company you need to set AllowCrossCompany to Yes.
The classes QueryRun and Query both have the AllowCrossCompany property, but their values always equal each other. When you read AllowCrossCompany from QueryRun, QueryRun reads it from Query. When you set AllowCrossCompany on QueryRun, it sets in on Query.
Please follow me to get the report from multiple companies as shown below.
Expand the datasources and add InventTable as datasource.
Right click on the report and open the report
If you want to restrict the report to only selected companies data , override the report init() method and add the following code in the init() method
public void init()