Jump to content

Sorting from script


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

Recommended Posts

I'm trying to adapt (unsuccessfully) a real neat sort routine I found in one of the Templates that either came with FM Pro, or one I downloaded from the FM website. The Template is Asset Management.fp5.

In the list layout, by clicking the column header (a button) the records are sorted in descending order. The next time the header is clicked the sort order changes to ascending, and so on. I've copied the scripts precisely, but can't get it to work. It's as if I'm mising a step. But if I do a manual descending sort, then click the header the records will resort to = ascending, but won't sort descending.

Does this Template have some hidden feature I don't see?

Also, next to the column header there is a small arrow that changes direction (up or down) when the records are sorted, either ascending or descending. I have no idea where this arrow is hidden and can't duplicate it in my database. I've tried copying it but it doesn't work.

Can someone please tell me what I'm missing or what is hidden in this template?? I've spend at least 20 hours trying to make this work. I'm really getting frustrated!!

Thanks.

Link to comment
Share on other sites

Create a global field that returns text.

Create 3 scripts:

Script "Ascending" that sorts in ascending order, then sets the global field to "ascending".

Script "Descending" that sorts in descending order, then sets the global field to "descending".

Main "Sort" script (this one is attached to the button) that determines whether the global field equals "ascending" or "descending" and performs the proper script.

That should do it.

Link to comment
Share on other sites

What Dan gave you works. Try the following:

Do the ascending sort manually. Then edit the ascending sort script and close it. You'll get a screen that has a bunch of ratio buttons with 'keep' and 'replace'. Click on 'Replace' to replace whatever sort specs have been saved with the script. Do the same thing with the decending sort script (preceded by doing a manual decending sort.

As far as the buttons are concerned: The up and down arrows are probably stored in a global container field with 2 repetitions. You'll need a calculation field whose type is also container that copies an arrow from one of the repetitions depending upon what type of sort your doing.

[ March 02, 2002, 03:23 PM: Message edited by: Steveinvegas ]

Link to comment
Share on other sites

Sounds like you need to actually perform a Sort manually, first do ascending. Now open your ascending script, click OK, then it will ask if you want to keep or replace the Sort order. Replace. Do the same for descending, i.e., manually sort, then replace the sort order. Now your scripts should work as expected.

Link to comment
Share on other sites

Thanks a bunch guys! It works like a charm. Steveinvegas, your explanation really helped. I can see what Dan was trying to get across to me now. I should have explained I was a dummy instead of a novice! smile.gif

I sure do appreciate all your help. You wouldn't believe the amount of time I've spent trying to track this down!

Dave

Link to comment
Share on other sites

This topic is 7166 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
 Share

×
×
  • Create New...

Important Information

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