January 15, 200322 yr Hi All File A , 2 fields , Field A1 = 12 Field A2 = nil so unique key= 12nil so first time I go from File A to File B ..I create a record in File and set unique key of File B = 12nil Second time I change Field A1= 12 Field A2 = 123 so uniquekey = 12123 So How can I go From File A to File B which don't create new record in File B but go to the same record of File B (12nil) and change unique key of File B = 12123. Somebody can help me with this since I tried many ways but no idea how to implement that ...since I know that one unique key to one unique can not change like that? I really need your help Thanks All
January 15, 200322 yr Start with the following premise: Keys NEVER change, keys are NOT accessible or ever seen by the user and user/system modifiable values are NOT keys. So create a unique key to link the records and establish a relationship via this field. Then you can use this relationship to modify those other identifiers as they change. I suggest looking into the following thread for my implementation of a unique key system, which is the primary linking system for the relationships, and can be used when other user-defined linking systems (such as CustomerID, or InvoiceNumber, etc) need to be modified. CaptKurt's Unique Key System
January 15, 200322 yr Author Thanks Capkurt, you make my day... That is what i am thinking but could not figure out how to make primary key. Once again Thanks
January 15, 200322 yr Author But if I duplicate it gives me the same primary ...how can we avoid it? I want that when it is duplicate it gives different primary ... Any idea? Thanks
January 15, 200322 yr I control all record creation and duplication through scripting and I do not allow user access to the menu for record creation. So they cannot choose Duplicate Record or press Command-D. They must press a "Duplicate" button on the layout. This then allows me to assign a new PrimaryID to the duplicated record, as well as whatever other functions need to happen upon duplication.
January 17, 200322 yr Author When I duplicate I got a new primary key ...do you know how to get a duplicate of related file with the new primary key when I duplicate the original file. Thanks
January 17, 200322 yr To duplicate a set of related records, you'll need to do some scripting. Basically I do the following: Store Original PrimaryID (i.e. CustomerID_pkey) Duplicate Record, Assign New PrimaryID, Store New PrimaryID Goto Related Records by Original PrimaryID Loop Through Related Records, Duplicate Record, Set the ForeignKey (i.e. CustomerID_fkey) to the New PrimaryID. Also make sure to Assign a new PrimaryID (i.e. InvoiceID_pkey) to the duplicated record. Eventually you will have duplicated all related records and set thier ForeignKey to the new PrimaryID.
January 17, 200322 yr Author Thanks Capkurt ... I got your idea ... Once more ...thanks ...because that problem gives me headache
Create an account or sign in to comment