The question is whether you need to preserve the current found set and just change current records or not.
On RecordLoad could perform a script that updates a global variable or global field with the primary key of the current record to form a list of the last N records visited. Selecting from this list of values could be set up to perform a find for that record or, if that value were placed by the script into a global field used as the match field in a self join, Go to related records could be used to return you to that record. GTRR would be the option to use if you just want to change current records without modifying the current found set.
I don't need to preserve any found set.
The "On RecordLoad could perform a script that updates a global variable or global field with the primary key of the current record to form a list of the last N records visited." sounds perfect; how do I achieve this? Is there a handy demo file on dropbox with this, or instructions here.
For last N records visited; I would think it would be useful to show the last 20 records.
I have two main tables in my database that I would want to do this for.
Thanks for the suggestions, it sounds a lot better than my workaround, which would be to add a check box on each record that I would check as I view records I will probably want to see again later in the day, then just find on this check box.
Do you know how to create a conditional value list? Once we have a list of values for most recent records, that's one option. A portal that lists them where you click a portal row button to select one could also be used. Both rely on using the list of values as the match field in a relationship.
OnRecordLoad might perform a script like this to build the list in a global field. (We could use a global variable, but with a field, we've got our match field for a relationship.):
Set Field [ YourTable::gLast20Visited ; List ( RightValues ( YourTable::gLast20Visited ; 19 ) ; YourTable::__pkYourTableID ) ]
This appends the primary key of the current record to the end of a return separated list of values, but then "prunes" the list to just the most recently appended 20 values.
A self join relationship:
YourTable::gLast20Visited = YourTable 2::__pkYourTableID ]
would then match only to the most recently visited 20 records in YourTable. YourTable 2 would be a second Tutorial: What are Table Occurrences? of YourTable.
I'll try to make this work and let you know tomorrow. From what I know of FM it looks logical and I should be able to get it to run.
Something you said made it click. I was overcomplicating the idea, and reading your advice, I thought it would be a lot better to keep it simple.
I've added a new radio button called ROLODEX. If I think I'm going to need to keep going back to a record during the day I click this now.
At the end of the day I replace field with "".
It's working great.
Thanks Phil, great trick, but I'm sorry to say I think there's a flaw in the logic :
"Set Field [ YourTable::gLast20Visited ; List ( RightValues ( YourTable::gLast20Visited ; 19 ) ; YourTable::__pkYourTableID ) ]
This appends the primary key of the current record to the end of a return separated list of values, but then "prunes" the list to just the most recently appended 20 values."
what this seems to do is prune the list to the last 20 entries, including the carriage returns.... Through trial and error, I found I had to set my RightValues second parameter to 37 to get the last twenty entries.
A parameter 37 makes no sense.
RightValues does include an extra return after the 19th value. I had assumed that List would omit that extra return as it is supposed to omit empty values from the list, but what you report suggests that it does not treat the return as an empty value. There are ways to enclose RightValues inside a left or middle function that removes that unneeded return.
makes no sense .. but works perfectly
in my case, I'm wanting the last nine records browsed, so I have a portal to the second TO, of eight rows, set to Initial Row 2 (to exclude current record)which is updated OnRecordLoad, using Phil's routine.
Through trial and error, I found that to display n records, the second parameter of the RightValues expression had to be set to (n/2 - 3), tested in edit box, checkbox, dropdown and popup, all same results, also doesn't appear to matter if gLastnvisited is Text or Number, so for 9 records, parameter is set to 15.
Yes but I'm thinking that your value of "37" won't continue to work in all situations as it appears you had to increase the number to adjust for the presence of return characters occupying locations in the list of values--and that's something that will vary each time you interact with your layout.
I think that you'll find that if you use this calculation, things will work out more simply:
Let ( theList =RightValues ( YourTable::gLast20Visited ; 19 ) ; List ( Left ( TheList ; Length (TheList ) - 1 ) ; YourTable::__pkYourTableID ) )
The code: Left ( TheList ; Length (TheList ) will strip off the extra return that's messing things up.