I can't see a way to use recordID, directly but there is a way to do this:
Let's assume you have a serial number field that uniquely identifies each record.
Define a global number field gCurrentRecord.
Write a script that saves the IDfield's value in a related table and have this script run when you close the database.
Create a self join relationship:
YourTable::gCurrentRecord = YourTableSelf::IDfield
Now your script can look like this:
Set Field [gCurrentRecord; Table::fieldwhereyousavedtheID]
Go To Related Record [From table: "YourTableSelf"; using layout <current layout>]
As long as the desired record is part of the current found set, GTRR in this form will make your "saved" record the current record without altering your found set.
Go To Related Records is a very useful tool, but which is very poorly documented. To learn more about GTRR, click the following link:
The Complete Go To Related Record
That worked fine. Thanks. I had been considering this before reading your excellent description but had had a suspicion it might be achievable with the GoToRecord step. BTW I've read all you've written on GTRR and as a result have eliminated a few instances of the step and made it iron-clad when necessary by capturing errors. This may be the first time I've used the step where error capturing is redundant! The record HAS to have existed; otherwise the global field could not have been saved with the particular value in the first place. Since the first script runs only on closing the file and a record can't be deleted without reopening the file, it seems foolproof (where have I heard THAT before?).
A curiosity that I don't have time to play with at the moment...
. . . I've created a global field, let's call it gSet, and the closing script sets the field with a value.
For my own curiosity, and hopefully the benefit of others as well:
My understanding is that globals are "per-user-session". Would that not therefore end when using the closing script? I re-insert values into globals on startup because they're blank when I re-open the app. How does the above 'find and identify' process work with globals that are set at the end of the user session?
The application isn't running on a server. As far as I can tell, the value is retained for the same user which is the way I want it. Before implementing this it was unpredictable, when opening the file, what record would have focus. This way it's easier to pick up where I left off, or in the ballpark of where I want to be, when I re-open the file. If another user were to log on I expect the global would be reset. Anyway it works well . . . very convenient.
When you use Go To Related Record [From table: "YourTableSelf"; using layout <current layout>]
the <current layout> option is treated as a special case (it replicates the old "pre FMP 7" GTRR) and no trapping for error codes is strictly necessary.