Newbie scripting issue - change value in field based on value in related field
Coming from 4D, I'm at sea as to how scripting works in FileMaker, perhaps due to the differences in the names of script "steps" (?). I can't figure out what steps are necessary to perform the desired actions. I keep trying to find FileMaker steps that are equivalent to known 4D commands and I'm getting nowhere. Clearly, the two programs have very different scripting structures.
Basically, I have a set of related tables, and I'd like to set the values of certain fields in a portal based on a value I've entered in another field in that portal. It involves looking up the values in related tables.
Current table: Invoices, with portal for Invoice Details table; client value in Invoices table is set from Clients related table.
In the Invoice Details portal, I have fields for Category, units, rate, and subtotal; the Cagetory field is a popup filled with values from the Category table. I want to select a value from the Category popup and then automatically fill in the Rate. The Rate value would come from a Rates table related to the Client record that is related to the current Invoice. The script should look something like this in plain English:
Go to the related record in the Clients table
Find the field in the related Rates table that matches the value selected from the popup
Set the value of the field Rates in Invoice Details to the value found in the related record in the Rates Table
I'd think this kind of thing would be basic stuff, and I'm sure that FileMaker can do it, but I don't know how to write a script that does it. I have the script reference, I just need to know which steps I should be looking at. Can someone give this FileMaker newbie a few hints?