Table relations to a shared table

I’ve a table (T1) with a table relation to the customer table. Normally when the customer is modified, the reference to my table is also automatically modified. My problem is, that the table T1 is shared between all companies. Because of that, I can’t get the reference automaically updated. What can I do to prevent this ?? Best Regards. Jan Kristensen

Not sure I understand what your problem is. What are you trying to prevent? The renaming of the customer.“no.” field? Taylor McCartney Development Specialist CSB Systems tmccartney@csbsystems.com

Jan - As You say You self, the table do not have DataPerCompany. How Would Navision know which relation to use! Anyways, you can - on the customer table - OnRename do something in this direction:


{Customer - OnRename}
SharedTable.reset;
SharedTable.setcurrentkey("Customer No."...);
SharedTable.setrange("Customer No.",xRec."No.");
if SharedTable.find('-') then
  repeat
    SharedTable2 := SharedTable;
    SharedTable2."Customer No." := "No.";
    SharedTable2.modify;
  until SharedTable.next = 0;

But what about if you allready have annother record with this new customer no, based on annother company! You really have to make sure, that You get Your ass covered :slight_smile: //Henrik Helgesen -: KISS::Keep it Simple, Stupid :- Edited by - hhelgesen on 2001 Nov 07 23:12:50

Hi Jan, it is maybe a bit overkill because you say you want to prevent the renaming, (just place an error in the OnRename-trigger), but when it is a problem what Henrik says: YourTable.SETCURRENTKEY(“Customer No.”); YourTable.SETRANGE(“Customer No.”, xRec.“No.”); YourTable.SETRANGE(Company, COMPANYNAME); YourTable.MODIFYALL(“Customer No.”, “No.”); Where Company is a new field with a relation to the virtual table Company. To be sure that your ass is totally covered you can place some coding in the OnInsert-trigger of YourTable where the company is filled. Regards, Reijer