Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Paste PK into related FK

Featured Replies

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...

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.

  • Author

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

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.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.