There is no "following script" in your post. See the info at the end of this post for a list of methods that can be used to post a script to this forum.
Copy and Paste should work but are not the ideal method as Copy overwrites any data in the clipboard that a user may have previously copied. This confuses and irritates people and is easily avoided by using other methods to move data from one place to another in FileMaker.
Instead of Copy, use Set Variable. Instead of Paste, use Set Field and refer to your variable in the calculated results portion of set field.
There is a script step, Go to Portal Row [Last]
That can put the focus into the last row of the portal so that a set field step will modify a field in the last portal row instead of the first.
But this can be complicated by the fact that the last portal row may or may not be a special "add row" for adding new related records. This will be the case if "allow creation of records via this relationship" is enabled for the portal table in the relationship on which this portal is based. If an add row exists in the portal, this combination of go to portal row [last] and set field will create a new portal record. If such a row does not exist, the same steps will modify data in the last existing record in the portal.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
Thanks Phil, that worked perfectly! Here's the working script:
Oops, here's the script:
You are correct on all counts!