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.

Automatically create new related files

Featured Replies

I have two related tables where each record in table A has exactly two related records in table B. Is there a way to script table A such that whenever a new record is created, two related records are simultaniously created in table B? I would rather not have to rely on buttons to start scripts, etc. if I can. FM makes it easy to automatically delete related records but it's the creation I'm struggling with.

There is much more to this solution than I am explaining but this is the sticking point in my progress.

Thanks!!!

Without using plugins, there really isn't a way to trigger a script on record creation. If you had FM7, you could use the example free plugin that comes with FM7 Dev and is posted at databasepros.com.

If you use a portal to create related records, The script itself would look something like:

New Record/Request //This creates the parent record

Go to portal row[last] //

Set Field [whatever you want it to be]//this will create the related record

Repeat the last two steps for as many records as you want... If you want alot, consider using a loop to to this.

You could also change the script to store the primary key in a global, and then use that in a script in the related table to set the foreign key value.

Hope this helps,

Dana

  • Author

Thank you, that portal script is good to know.

It occurs to me that I will only be accessing table B for reports (not often) so I could create a startup script that loops through table A and creates the necessary related records in table B. It would cause a logjam while processing but it will be up to date when I need it.

Any other ideas would be greatly appreciated!

Thanks!

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.