Jump to content
Sign in to follow this  

Updating Fields in Related Tables

Recommended Posts

I am not sure about the way Filemaker handles Set Field commands for related tables in scripts. With FM7, we are instructed to Commit Records whenever the Set Field command is used, or else changes will not be recorded. But what happens when you issue a Set Field command on a related table?

My situation is this: I have an Items Purchased table and a Clients table. When a client purchases an item, I run a script that creates the item record and updates the client's account balance. In the past, I simply had:

Set Field["ItemToClient::AcctBal"; "ItemToClient::AcctBal" - ItemCost]

Since the record was in another table, the update was automatic. Now, however, if I add a Commit Record step to this, I don't know which record is being committed. Am I committing the Item record, or the Client record?

I am considering creating a separate SetBalance script that opens a new window, sets the balance, commits the record, and closes the window--but I wonder whether this is overkill. I also wonder whether I will have to add something to my original script to be sure that the change in Client balance is picked up by the Item routine.


Share this post

Link to post
Share on other sites

You are committing the parent record in the current table. From the online Help: "When you change related data (such as related records displayed in a portal), these changes are not committed until you commit the record that is displaying the related data."

Opening a new window, changing the data, committing the record, and closing the window would indeed be overkill for

Set Field [relationship::field; relationship::field - currenttable::field]

Commit Records/Requests

Share this post

Link to post
Share on other sites

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

Sign in to follow this  


Important Information

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