evancooney Posted July 7, 2003 Posted July 7, 2003 How can I perform a default sort everytime my database is opened? The "Sort" script step seems like the best it can do is repeat the last sort, but if the database is just opened, it doesn't remember the last sort. Also, what is the default sort order? Regards, EMC
EddyB Posted July 7, 2003 Posted July 7, 2003 The way the sort script step works is: 1) You perform a manual sort 2) Then add the sort script step to your script 3) The sort script uses the sort defined in step 1 4) This will not change when you do another manual sort, it will always remeber the sort you did before adding the sort step 5) The only time it will change is if you change something in the script then when prompted, rather than choosing keep current sort, you click replace sort. Now you have your script to do the sort you want, go to EDIT > PREFERENCES > DOCUMENT and set the option - "When opening, perform script" and select your script there. Now every time you open that DB, the sort you did manually in step 1 above, will be performed. Ed.
Fitch Posted July 7, 2003 Posted July 7, 2003 1. Do a Sort 2. Create a script with one step: Sort (restore, no dialog) 3. In the document prefs, set this script to perform when opening. Standard practice among FileMaker developers is to create many Sort scripts, and then attach them to buttons at the top of list layouts. Some of us even do stuff like: If (Status (CurrentModifierKeys) = 1 ) .. Perform Script (Sort - name, ascending) Else .. Perform Script (Sort - name, descending) End If Also... By default sort order, I assume you mean the order when the db is unsorted. This is simply the order in which the records were created. The only way to permanently change it is to sort your records, then export them, delete all records, and import the original (sorted) records. But as soon as you create a new record, you'd have to do it all over again. If your db is single-user, it will in fact remember the last sort. But it won't remember if you're opening a db that's hosted over a network.
evancooney Posted July 10, 2003 Author Posted July 10, 2003 That is the problem. My data is over a network. Can I still set it up to single -user, but still have it over the network? I know there is an option in FM Server "Host Single-User Files" Thanks, EvanC
-Queue- Posted July 10, 2003 Posted July 10, 2003 I have quite a few dbs that have an on open script with a sort. As long as you replace the sort in the script once you have created it (or sort and then create the script), I don't see why there should be any problems.
evancooney Posted July 15, 2003 Author Posted July 15, 2003 Hmmm. It still doesn't work. Do you have your files setup as single or multi-user?
Ugo DI LUCA Posted July 16, 2003 Posted July 16, 2003 Fitch said: If your db is single-user, it will in fact remember the last sort. But it won't remember if you're opening a db that's hosted over a network. What about using a set of globals and GetField ??
-Queue- Posted July 16, 2003 Posted July 16, 2003 I think you mean it won't remember the last sort performed once a db is closed. But you can easily set up a sort, create your script with the sort, and set the script to run on open. I do this with several files that are multi-user.
Recommended Posts
This topic is 7805 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now