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.

Creating record into related table via script

Featured Replies

On a single file with two tables, the first table becomes the default(current). How can I switch to the other table? If I create a =relationship between 2 tables, how can I add records into the related table via script?

This done easily using 2 related files but I can't figure out how to do it on 2 related tables(on a single file).

Any light would be highly appreciated.

Thanks in advance,

Garry

Create a layout which are using the other table (created automaticly when you created your table)

If you create a new layout, have a look in the "layout setup" for "show records from" and choose the other table

GoToLayout ["other layout" (other table)]

NewRecord/Request

(+ GoToLayout[original layout]

Alternatively, you might consider creating records in the other table without ever leaving the layout for your default table.

This is done by setting up a relationship with the 'Allow creation of records via this relationship' option enabled and then writing a value into a field in the other table. You can either use a portal to do this, or you can set up a utility relationhip to the other table which is based on a global field in the current table.

In the latter case, your script (or your user) should first place a (unique) value into the global field and then place a value into a related field - whereupon a new related record will be created. wink.gif

Here is an example of creating new records in a related table without the use of a script. (Courtesy of "Using Filemaker 7" A great book btw.)

Using a utility relationship and the appropriate auto-enter option for the foreign key fields in the "many" table, you can place the related fields on the "one" layout and use them to create a new child record by filling them in and committing the record. The cool part is how the fields clear themselves automatically after the commit by resetting the temporary foreign key.

HTH,

Dana

test.fp7.zip

  • Author

Thanks so much guys!

Garry

Althoug I would vote for movement of the entire thread, is there yet another way - that have existed the last 9-10 years, after an upgrade to 3.0:

http://www.filemakerpros.com/Related_Match_Field.zip

Which is a cool variation over 'Allow creation of records via this relationship' Ray mentions, because if you have buttons in a portalrow will they not dangle in empty records, the scripting as such is pretty simple:

Go To Portalrow [Last]

Go To Portalrow [Next]

--sd

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.