Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Creating record into related table via script


This topic is 7175 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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]

Posted

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

Posted

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

Posted

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

This topic is 7175 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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