Hi,
I have a requirement to build a report to update data of a table for other companies ( same Nav database)
Input: table id
Run the report in the company A for table XXX;
For each record: check if the data in table XXX in company has same value -> if yes then do nothing.
If no and the record is not exist -> insert the record to table XXX in company B
If no and the record exist -> check which fields are modified -> only update these changed fields.
For this requirement: I need to check what is the primary key fields of a table; so I will check if we need to update or insert. and also I need to compare all the fields of a table between two company.
this solution is also need to be generic ( table need to be copied will be key in by users in input screen) we don't know fixed table in advance.
*This post is locked for comments
As Mohana said you need to check on CHANGECOMPANY - which will allow you to change the company during runtime. Make sure to change the company back to original company once the calculation is over, otherwise rest of the logic will apply to the changed company.
https://msdn.microsoft.com/en-us/library/dd338929(v=nav.90).aspx
About the fields, you need to check on RecordRef and FieldRef and KeyRef functions in Dynamics NAV.
Hi,
You need to use changecompany function to update the records from one company to another
check CHANGECOMPANY, RecordRef and FieldRef and KeyRef
Sohail Ahmed
2
mmv
2
Amol Salvi
2