Jump to content

Paste PK into related FK


bbaliner
 Share

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

Recommended Posts

Long time no speak,

Hope everyone's New Year was great. I would like to know if there are any known database issues/problems with the following:

My user can view, alter and create records in Child file portal from within the Parent file. When the new record is created in Parent, the PK auto-number is given to the Parent record. But to make a relationship, the user needs to mannually type this number into the portal Child record. I wrote a script (based on another relationship to avoid cercular reference) to copy this auto-number and paste it into the related FK field in the portal, so when the user clicks the button the relationship is created automatically.

Has anyone experienced any problems with doing things this way? I appreciate your input.

Biking in the snow is still biking...

Link to comment
Share on other sites

Filemaker will automatically assign the correct fields if you are creating a record via a portal that allows creation of related records.

If you are creating records via some other procedure then you will need to do the assignment via scripting, lookups, auto-entered calculations or some combination thereof.

The best method (in my opinion) is to have the user click a "New Record" button which creates the records and does all the field/key assignment and finally puts the user into an editing screen.

It sounds like you are pretty much there, but just need to automate things a bit more to take some of the guesswork/power out of the users hands.

Link to comment
Share on other sites

Capt,

My relationship allows creation of related records, but how will "Filemaker will automatically assign the correct fields if you are creating a record via a portal"? Is there internal mechanism to do that?

When I'm in the Parent file, the New Record command creates a new record in that Parent file, not in the Child file. As of now I have a script that pastes the PK number from Parent into FK field in Child, but sounds like there's a better way. Can you please explain?

Thanks

Link to comment
Share on other sites

quote:

Originally posted by BikeBoy:

My relationship allows creation of related records, but how will "Filemaker will automatically assign the correct fields if you are creating a record via a portal"? Is there internal mechanism to do that?

Of course, how else would Filemaker be able to keep track of which records are shown in the portal. Basically if you relationship if based upon PK = FK, then creating a new record via the portal will fill in the FK based upon the current PK.

quote:

When I'm in the Parent file, the New Record command creates a new record in that Parent file, not in the Child file. As of now I have a script that pastes the PK number from Parent into FK field in Child, but sounds like there's a better way. Can you please explain?

You need to write a script in the parent file which calls a script in the child file to create a new record and assign the proper IDs. Same with deletion functionality.

Link to comment
Share on other sites

This topic is 7225 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
 Share

×
×
  • Create New...

Important Information

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