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

Re-serialize Primary Key and sync(?) Foreign Key


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

Recommended Posts

Posted

I need to re-serialize (using Replace Field Contents) a few of my primary key serial IDs (Indexed, Auto-Enter Serial, Can’t Modify Auto). Each primary key has a foreign key equivalent in another table. If I re-serialize the primary keys, will the foreign keys automatically be filled in, or is there some process/command that I can use to fill them in so that I don’t have to do it manually? I guess I want to re-serialize the primary keys and somehow sync their respective foreign keys so they match up. Not sure if I’m asking this the right way. I hope you can help. TIA lpm

WinXP

FM9Adv

Posted

If I re-serialize the primary keys, will the foreign keys automatically be filled in

No. You need to do this in stages: first, create and populate a NEW primary key field in the parent table; then, using the existing relationship/s, populate a new foreign key field in the child table/s with the parent value. Finally, switch the relationship/s to use the new fields and delete the old ones.

Having a backup is strongly recommended.

Posted

I think I’m beginning to understand this better, but not totally.

…“populate a NEW primary key in the parent table”

I’m assuming I populate the new primary key field by re-serializing it (replace field contents).

…“populate a NEW foreign key field in the child table/s with the parent value”

This is where I am having difficulty understanding. Do I populate the new foreign key fields by manually/individually entering the parent values in the foreign key field in each record or by some other process?

I’m almost there… Thanks for your patience.

Posted

[color:green]I’m assuming I populate the new primary key field by re-serializing it (replace field contents).

Sure. But be sure to 1) show all records first and 2) be sure no Users are in the system which might lock a record (which would keep the serial from setting). Then, be sure to check the checkbox 'Update Serial in Entry Options' and of course, back up first.

[color:green]

“populate a NEW foreign key field in the child table/s with the parent value”

Go to your child table. You already have a good relationship between parent and child (based upon the ID, right?). So those children know who their parents are. Create a new parent ID field in the child. Show all records and set the new parentID with: Parent::newParentSerial (again using Replace Field Contents when no Users are in systems.)

But why do you need to reserialize SOME of your records? If you need to reseralize them, doesn't this indicate that your primary (regular) relationship is broken? If so, then this reserializatios process will not work. Please clarify why you need to reseralize SOME of your records (and their children). If the relationships are broken then you need to determine what information in both tables can be concatenated to temporarily re-create a proper match first.

LaRetta

This topic is 5823 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.