Hi all, The client has a typical requirement. Client has one database with 5 different companies, one of the company among this is a Consolidated company for all the companies. The consolidated company has no Customers, Vendors in it but when user logs in he/she should be able to see customers and vendors as well as other data from another company in the consolidated company, Is it possible in Navision. If yes please let me know the procedure how. Thanks in advance.
Is the customers and vendor s are common in all companies? if that so then, you can change the table property “DataperCompany” to No. this way, all companies will see all the customers and vendors from all the companies. If that’s not the solution for you than, programmatically you can do it. you can use command “table.changeCompany()”. this way you can get the data from any other company into current company. Hope this will help. Naveen Jain
Hi thanks for the reply I am already aware of the solution which u suggested but i dont want to copy the data to the company in which i want to see but i just want to access data from the company in which data is lying. If i will change the datapercompany property to No of particular table then it will populate the records to each company and that my client dont want to do. Thanks again
Actually that property doesn’t make it so the program crates a copy in each company, it makes it so that there is only one table that is accessed from all companies, instead of a set of data for each company. By doing CHANGECOMPANY, you don’t make a copy of the data either, you change the company of the recordvariable, so you can see the values in the other company. This is a very tricky part of Navision though, so be careful with what you do. For instance, if you are in company A and you do MyRec.CHANGECOMPANY(‘B’), and you do a VALIDATE on a field that gets data from another table, it will get the data in the other variable from company A, and updates the MyRec in company B. In other words, make sure that ALL record type variables of the process are working in the same company.
Let say there are two companies A and B. At present i m loged into company A. I want to see some data which are lying in Company B but dont want it to get copied in company A. So basically i Dont want the data to be copied in the company A but i just want to access and see data which lies in company B. I have used CHANGECOMPANY before and done few things but this time i dont want the data to be copied in the company in which i m logged in. I think this example will clarify my point of view.
you should use CHANGECOMPANY in this case. lets say you are in company A. You want to copy all the items with in certain filters from company B. take a rec variable of type rec for table Item. Let say your variable is ItemB. do ItemB.CHANGECOMPANY. make your filters on Item B and copy all the records from ItemB into the current rec. Here is what I did. Very simple example. I created one item (TextX) in company B and copied to company A. ItemB.CHANGECOMPANY(B); ItemB.SETRANGE(“No.”,‘TestX’); if ItemB.FIND(’-’) then begin ItemA.INIT; ItemA.COPY(ItemB); ItemA.INSERT; end; Hope this make sense. Naveen Jain
Hi Kashyap, Listen (!) to Daniel. You will have to do some development work here. I understand that when u r logged-in to the consolidation company you want to be able to see data from another company (Company B). First decide what data you wnat to see. Then build the forms / reports that show that data. In teh C/AL code in those objects use CHANGECOMPANY for the data variable that you wnat to see. It’s not complicated and you do not need to copy data between the companies. Good luck.
I never said you have to copy. If you look my code, its available once you do the change company. after that you can do what ever you want to do with that data.