Skip to main content

Posts

Showing posts with the label axapta cross company

crosscompany

Metod 1; container conCompanies; while select dataArea where !dataArea.isVirtual { conCompanies += [dataArea.id]; } while select crosscompany : conCompanies inventTable { // ... do something ... } metod 2; public Query buildQuery() { Query query = new Query(); QueryBuildDataSource qbds; DataArea dataArea; ; query.allowCrossCompany(true); while select dataArea where !dataArea.isVirtual { query.addCompanyRange(dataArea.id); } qbds = query.addDataSource(tablenum(InventTable)); qbds.addRange(fieldnum(InventTable, ItemId)); qbds.addRange(fieldnum(InventTable, PrimaryVendorId)); return query; } metod 3; DataArea dataArea; ; while select dataArea where !dataArea.isVirtual { changeCompany(dataArea.id) { // ... do something ... } }

Cross company reports [AllowCrossCompany] in Dynamics AX , X++

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. Right click on AOT >> Reports and Create a new report by name “SR_CrossCompanyItems” as shown below Expand the datasources and add InventTable as datasource. On the Query Node, right click and go to property and set the AllowCrossCompany peroperty to “Yes” as shown below. ...

What does this mean: "The form datasource query object does not support changing its AllowCrossCompany property after the form has executed the query."?

I have made a form with datasources vendtable and vendtrans. Inside vendtable_ds.executequery() looks like this: QueryBuildDataSource queryBuildDatasource ,queryBDS_VendTrans_Invoice; ; queryBuildDatasource = this.query().dataSourceTable(tablenum(vendtable)); queryBDS_VendTrans_Invoice = this.query().dataSourceTable(tablenum(vendtrans)); if (curext() == "MASTERCOMP") { this.query().allowCrossCompany(true); } else { this.query().allowCrossCompany(false); } //FilterVendorName = stringedit control on form if (FilterVendorName.text()) { queryBuildDatasource.addRange(fieldNum(VendTable,Name)).value(strfmt("*%1*", FilterVendorName.text())); } else { queryBuildDatasource.clearRange(fieldNum(VendTable,Name)); } //FilterInvoiceNumber = stringedit control on form if (FilterInvoiceNumber.valueStr() == "") { queryBDS_VendTrans_Invoice.enabled(false); } else { queryBDS_VendTrans_Invoice.enabled(true); queryBDS_VendTrans_In...

How to access other data in other company accounts in Axapta / Cross Company

First of all we have to understand the concept of Axapta, that one AOS (Application Object Service) of Axapta can have many company accounts, one AOS can be described as one Group of company, and each company accounts in Axapta can be described as sub ordinary of the company group. Just say one group company who implemented Axapta wants to put all their sub ordinary company to one AOS, that mean we have to setup the parameter so that can have more than one company accounts, each company accounts can have their own setup parameters. There is one feature in Dynamics Ax 2009 which is can access other data in other company accounts through the code or through Data Source object, we called it cross company . For example cross company in DataSource. Each Form or Report object have DataSource to pull the data into it. We can add Table/Query object as DataSource or we can call them at runtime. This is the example how to setup the DataSource to enable the cross company feature below : ...