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.

Featured Replies

I've seen a few examples where the parent file creates a related record in the child file by simply performing a set field of the foreign key in the child file. The relationship is Parent ID -> Parent ID (in child file)

I tested it out and my question is how do you go about in creating multiple related records because

I tried the script step of just "Set Field[Parent_Child::Parent ID, Parent ID] and this only seems to work

when creating one related record. I ran it again and it didn't create another record.

The child file's primary key is Child ID with an auto-enter serial no.

What I have been doing is passing the foreign key through a global.

I realize this is a very simple question and I'm still trying to learn all the neat features of FileMaker as I try to improve.

Thanks...

Hi Macaroni,

It does not create a second record because a record already exists.

If your script runs on a layout with a portal for the Parent_Child relation you could precede the Set Field command with a 'Goto Portal Row[Last] step to force a new record to be created every time you run the script.

regards,

Ernst.

macaroni said:

I've seen a few examples where the parent file creates a related record in the child file by simply performing a set field of the foreign key in the child file. The relationship is Parent ID -> Parent ID (in child file)

There is an interesting alternative I've seen discussed elsewhere. Create a global field gSelectedChildRecID. Create a relationship to the child file based on this ID. Set allow creation of related records to ON. The fascinating part of this relationship is that if the global field is EMPTY and you use a script or manual entry to place values in the related fields, a new record will be created and the global field will auto-populate with the new child record ID! This behavior is consistent and has been in effect since 3.0.

So to create child records:

set field [gSelectedChildRecID, textToNum("")]

#now create the new record

set field [CreateByGlobal::InvoiceID, InvoiceID]

set field [CreateByGlobal::Qty, gQty]

set field [CreateByGlobal::PartNum, gPartNum]

exit record/request

Of course if you do place a value in gSelectedChildRecID, then you can edit the selected record. You would do this by attaching a script to row in a portal for instance:

set field [gSelectedChildRecID, Myportal::RecordID]

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.