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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

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