Usually when I write a script, I do it one script step at a time, testing it after each step that I add. I do this because the script steps that I add usually don't behave the way I expect them to based on their description. An example of a script step not working the way I expect it is this one:
Set Field [ IsolateData::Comments ; FieldNames ( Get ( Filename ) ; Get ( LayoutName ) ) ]
In short, I am asking it to list out the field names of the layout that I am looking at and place this list in the Comments field of table IsolateData.
The script step works fine if I do it when I am looking at the layout that has the receiving field "Comments", but if I switch to a different layout that doesn't have the field "Comments" in it, the script does nothing. I would expect the script step to place the list of field names in the designated "IsolateData::Comments" field whether I was looking at it or not. After all, both tables and layouts are in the same file and are related.
The description for the Set Field statement reads "Replaces the entire contents of the specified field in the current record with a calculation result." Can someone explain to me what "the current record" means? Do I have to actually be seeing the record (i.e. Go To Layout .... etc) to get the script step to perform? Why can't it do it in the background without the necessaty of adding script steps to go to that layout?
Thanks for any explanation you may have.
FileMaker Pro 16