Jump to content
Server Maintenance This Week. ×

Creating a Script for Sorting


This topic is 6540 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I am a novice FMP user, and have a question about creating a script for sorting. In FMP6, there is a database template for Personnel Records. In "List" view, there are column headers for several fields that, when clicked on, toggle between sorting the column alphabetically ascending/descending. I have tried following the Sorting scripts in the template to make columns for additional fields, to no avail. I seem to be missing a way to define a value in the Sort Ascending and Descending scripts (for example, in the Set Field line, there is reference to the term "departmentA" in the Sort Department Ascending script) and I don't know how to define this value for other fields. Can anyone out there help me? THANKS in advance!

Link to comment
Share on other sites

  • Newbies

Thanks very much for taking the time to answer my query. I wound up with 2 programs, an ascending and descending sort, but cannot coordinate them with a master script that toggles them when clicking on the column header (button). Tried looking at the scripts for other column headers, but again, they refer to values such as, If ["HiliteSortedBy = "firstNameA"]... which I don't know how to define. Not only that, but the other scripts cause a nice little triangle to point up or down for ascending and descending sorts, too. Sorry, probably should have specified "Beginner" not "Novice"!

Link to comment
Share on other sites

Hi, create an additional global number field for each field (column) you want to sort on. Let's call it gSortField1.

In your master Sort script, you do the following :

If [gSortField1=0]

Perform Script["Sort Ascending"]

Set Field [gSortField1=1]

Else

Perform Script ["Sort Descending"]

Set Field [gSortField1=0]

End If

You could of course do this in one script as well, using the Sort Script step in stead of the Perform Script step

Regards,

Peter

Link to comment
Share on other sites

This topic is 6540 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.