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.

Create related record?

Featured Replies

For a hobby here at home, I have a database with three tables: people, items, and items owned. People and Items Owned are both related through a serial number and Items and Items Owned are related through a second serial number.

In the layout for people I have a portal that shows items which that individual might purchase. Once a selection is made, I'm trying to write a script that will create a new record in the table of items owned with the serial number of the person and the serial number of the item purchased.

Is there a script step that will enable me to create a related record directly? Alternatively, is there a way to store both serial numbers temporarily, so I can paste them into the appropriate fields of a new record in "items owned"? I've tried "copy" and "paste" but this doesn't seem to work.

The only solution I've worked out so far is to have a preexisting record for each person in the table of items owned. Then I can "go to related record" in that table, duplicate it, and use the relationship between Items Owned and People to retreive the serial number of the item just purchased. But this is inelegant. Surely there's a better way?

Thanks,

Chuck Henebry

Yes you can do this in many ways. With FM 7 you can cascade between multiple relationships. If People is related to Items and Items is related to Items owned, with each relationship checked for 'Allow creation of records in this table via this relationship', you can have a portal to Items owned on the people layout. Create a button script for your list of new purchases, use a 'Go to Field' selecting the related field available from your portal, use a 'Go to Portal Row' selecting last, to make sure it adds a new row, then use 'Set Field' to add the data you want. You should use multiple set fields to set the proper Serial Number IDs as well as new purchase data.

Or

Create a script that created a new record in the related table, and use Set Fields from related tables.

  • Author

Thanks! I see now that my problem was that I didn't have my relationships marked for "Allow creation of records via this relationship." I appreciate your time and help.

Chuck

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.