it goes to the record that I clicked,
By what method do you do that? Are you sticking to one layout and not opening a new window? (Go to Related Records can do it either way).
If so, this is a problem encountered with that approach that does not occur if you open a new window instead.
Ir you prefer to keep it in one window, Set a variable to Get ( ActivePortalRowNumber ) before pulling up the specified related record on another layout. When the script or user returns, use Go to Object Name to put the focus back on teh correct portal (do this even if you have only one portal, that might change in the future) and use go to Portal row to put the focus back on the clicked portal row. This doesn't restore the portal scroll bar to its exact original position, but it does at least leave the clicked portal row visible.
Thank you for the fast reply!
Clicking the button in the portal navigates the the selected record in the same layout and does not open a new window. I'm trying to implement what you suggested, and I will hit you back if I have any further questions or to let you know the results.
"Reset Scroll bar when exiting record" is already unchecked. I've tried checking it as a test and it does the same thing it's always done.
What does your script do after it changes layouts?
1 of 1 people found this helpful
Well I am now going to criticize your boss's work.
Copy/paste should never be used in this fashion to move data from one Filemaker table to another:
a) It's "brittle". should the field being copied or the field being pasted be removed from their respective layouts, the script will fail to work and no error message will appear telling you that it didn't work.
b) It destroys any data that the user may have copied to the clipboard prior to running this script. This confuses and annoys users when they then paste from the clipboard only to get something copied by your script instead of something that they copied.
Use set variable in place of copy. Use Set Field in place of paste to move the data from the variable into the target field.
Next, Insert Text is not the best script step to use here. Insert Text is just as "brittle" as Copy and paste and for the same reason. Use Set Field instead of Insert. I only use Insert Text when I want to insert text into a field that already has text and I want to insert text at the cursor's current position inside that field.
But none of that specifically affects cursor position, but the layout change does as far as I know. It also does not appear that you've listed the entire script--otherwise this script never returns you to the original layout where you'd see that the portal has "snapped back".
Please note that I've previously listed your options for avoiding this.
I tweaked with the script based on your suggestions, and it seems to have fixed the original problem! Thank you so much!