Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

A little problem about Unique key ?


This topic is 8037 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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.

Posted

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

Posted

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.

This topic is 8037 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.