It's my understanding every table has DataAreaId field, so is this VendAgingReportTmp.
But, I can't see the field or browse to it , how can I display it on report.
Hi River, in this case it does not have a DataAreaId because the SaveDataPerCompany property is set No. You can add a new custom field to the table and populate this field in code or maybe enable the SaveDataPerCompany property. I don't know what the impact is enabling the property so test first.
I enabled property, but, the DataAreaId is still not showing up in dataset in report after refresh. So I add a field for it.
my question is this, once it's enabled, it means the table can save data just for one company, right?
Hi River, yes so it is better to add a field for this.
I have related question. In VendTable, which field indicates which company the record belongs to? DataAreaId? at least in our table, DataAreaId are all same. But, clearly it's not the case.
SaveDataPerCompany = Yes means data is saved per company (not just one company). So 2 different companies can have Vendor using the same account number despite AccountIdx (which contains the AccountNum field only) does not allow duplicates.
This is because at the backend DataAreaId is added to all indexes and with SaveDataPerCompany set to yes a different value will be store in the VendTable records.
So to your question, DataAreaId should indicate which company the record is in.
Note that if you check from the table browser it only shows record in the current company. That maybe the reason you see that all dataAreaId are the same.
Try do a simple query on VendTable in SSMS instead.
My blog | PBC
This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
Hi River, like Dominic mentioned, the DataAreaId fieds indicates which company the record belongs to, this allows multiple companies in the system. You can use the crossCompany or changeCompany keywords in a select statement or use the AllowCrossCompany property on a query in the AOT to query data across companies.
I did check in SSMS, it's all same in VendTable, and the value is no where found in company list, is it virtual company?
This question goes back to a report, vendagingreport we want to customize.
We want to run it across companies.
There are complex queries behind it to populate temp table.
Tried many things, latest, I used changecompany, put those queries/methods inside loop,
but, it crashed in the second company, is there any refresh method/process need to be called after changecompany?
In SSMS, do a
The DataAreaId code should be there. And you can check the IsVirtual flag to see if it's a virtual company
yeah, as I suspected, it's virtual company.
Question is, in VendTable, DataAreaId is this Virtual company, when you run query on this table, how it works?
There's no refresh required for changeCompany. Do you have a different method that contains the changeCompany code or do you have it in the main loop of your code?
It depends on your virtual company setup, so it will act "normally" if you query from a company that's setup as a virtual company.
It's in main loop. So far, I found it crashed in class : CustVendAgingCaculation->insertCustVendData,
Since first iteration is finished, it crashed for second company, I suspect there is memory/buffer issue here.
I tried to clear customersVendors, but, it doesn't help.
recordInsertList = new RecordInsertList(tableNum(CustVendTransAging), true, true, true, false, true, customersVendors); //customersVendors.clear();
custVendTable = _custVendQuery.get(this.getCustomerOrVendorTableId());
customersVendors.AccountNum = custVendTable.AccountNum;
customersVendors.GroupId = custVendTable.GroupId;
or, because CustVendTransAging table's 'SaveDataPerCompany' is No?
What's the error message? I always write the code that contains the changeCompany code in another method with local variables.
Thanks everybody, figured out.
When changecompany, need to re-initialize query, that fixed problem.
I have done cross company for ageing reports
1) make the main report query cross company,
2) get the data area of the customers and save it to a list
3) you have list of companies and list of customer in tmptable from the initial loop.
4) Now you need to customize the classes custVendAgingCalculation .
selectOpenTransactions ,selectSettledTransaction methods need to be change to loop on the list of companies you have.
Thats about it. The only big issue over here is if you have same customer ID in companies you end up in index duplication for few table.