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

Create a related child record from parent button

Featured Replies

Hi,

I have two files related - one to many.

The master can see all its children via a portal.

At present, to create a child record I type into a field in the portal and this creates the child-parent relationship, I can then go to the related child and carry on adding data. This is not ideal, I would rather have a button in the parent above the portal which can be selected and thus creates a child relating correctly to the parent.

What's the best way to do this please? - 2 scripts?

Step-by-step answers please as I'm not quiet used to the FileMaker lexicon.

This site is good.

J.

Basically, you need to copy the field in the parent file on which the relationship is based, then go to the child file, create a new record, and paste the copied value into the correct field.

I suggest creating a global field in the child file. Then create a script in the child file that creates a new record and sets the related field to the contents of the global field. Now create a script in the parent file that sets the related global field to the contents of the related field in the parent file, and then performs the external script. That oughta do it.

Note: There are several other ways to do this, as other people on this forum will no doubt tell you. Take a look at all of 'em.

Hi,

"I would rather have a button in the parent above the portal which can be selected and thus creates a child relating correctly to the parent."

Keeping the button Idea, and your current settings....

1. Create a fied you'll call "TemporaryKey" (text, num, or global).

2. Create a relationship from the "TemporaryKey" in Master to the field "Record_ID" in the related file. Call it "TempRel"

Note that we are talking about the Record_ID (eventuelly serial num), not the Foreign key from which you established your relationship for the portal.

3. Create a new layout with :

- a small sized portal (width - may be 2 main fields in it), and include in the right side of the portal row (in the portal) a button.

- all the related fields coming from relationship TemporaryKey::Record_ID that you wish to fill in when creating a related record.

4. Attach this script to the button :

Go to related records (TempRel)

---- > Perform External script : Set Field (g_temp, Record_ID)

Set Field (TemporaryKey, g_temp)

5. Now fill in the fields you want as if you were in the related file.

As I said, you could either use a text, number or global field for that. I'd prefer using a text/num as each temporary key would be different if you browse from record to record while being in the Master file.

When using a text/num fied, moving to next record would leave the related fields for that other record empty.

Hope this is clear and makes sense.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.