I have FMP 16 and am a newbie. Could someone help me with a script to do a sort by a predefined category, complete the sort and then return to the original record without the user having to deal with the sort window.
Maybe explain a bit more in detail what you're trying to do, and why.
You can store the record ID with Get(RecordID) in a $var and after any sort, while in Freeze Window state, loop through records from first till you reach the one that has recordID = $var.
If you are in a found set and are not leaving the layout, your user will remain in the same record, so you shouldn’t need to do anything, unless there is part of this that you’ve not explained. For instance, if you are in record 1 of 100 unsorted, then sort and the sort puts this record as record 50, you will be looking at the same record but at record number 50.
ps I forgot to say, ensure the ‘Sort Records’ script step has ‘With dialog’ set to ‘Off’ so the sort window isn’t displayed.
I have created a database for a client and I don't want them changing the sort order. Also I wish to give them a database that doesn't involve making too many decisions. I suppose it doesn't matter if they are not returned to the same record, but they should be in the same layout.
I have a "Sort" button that is scripted with a single step. It takes the viewer to the "Sort Records" window. Is there a script that will do the sort without stopping at the "Sort Records" window and then go back to the original layout?
What is the sort records window? A different layout? What Table is that Layout based on? What table is the original layout based on?
Yes, as per my post earlier, there is an option within the single line that you can click on and toggle the ‘With dialog’ ‘On’ or ‘Off’ - off will stop the sort records window from appearing.
However, your original post also wanted to go back to an original layout. You will need the button to call a script of more than one line to do that using the ‘Go to layout’ script step.
Thank you Andy. I had tried the script with the "off" toggle, but then when I hit the "Sort " button, nothing seemed to happen. I hadn't realized that an unseen sort had occurred. That's great, and very easy.
Retrieving data ...