yalebulldog Posted October 1, 2004 Posted October 1, 2004 Is there a way in FM7 that you can create a button to sort a portal. I know you can define a sort when you create a portal, but say the user what the change to a pre-define sort (ex. alpha based on lastname). Thanks for your help!
RalphL Posted October 1, 2004 Posted October 1, 2004 In FMP7 you can set the sort in the portal when in the layout mode. Make duplicate layouts, 1 for each sort order. Set the sort order in each layout. Give the user buttons which switch layouts for the desired sort order.
yalebulldog Posted October 1, 2004 Author Posted October 1, 2004 Thanks for your response, sounds good!
Hijack Posted October 7, 2004 Posted October 7, 2004 Ungowa! That's a bit of work. Here's how I have a single, dynamically sortable portal: In your related table, create a normal global text field called "Sort Selector". Then, create two fields, both calculations. One called "Sorted On Text" an another called "Sorted on Number". The relationship definition (not the portal itself) needs to be sorted first by the "Sorted On Number" field and then on "Sorted On Text". Ascending, descending, how ever you'd like it. The value of "Sorted On Text" field would be something like: Case ( Main:Sort Selector = "Name" ; Main:Name ; Main:Sort Selector = "Occupation" ; Main:Occupation ; "" ) The value of the "Sorted On Number" field would be structured the same way as "Sorted on Text" but using numeric source fields. So, you see what we're going for here.... When you change the value of the "Sort Selector" field, the contents of the "Sorted By Text" and "Sorted By Number" fields will change and the portal sort order will change accordingly. Just create a Value list of the various sort methods and then structure your CASE statements to look for the right choices and put in the right value from other fields. This approach can be altered to include two selector fields that each control different sort fields so you can have a two-level sort approach if so desired. The important thing is to always have the case statement in the field calculations set the field to "" (empty) if the "Sort Selector" field does not contain anything it should sort of. That way, the other field will control the sort order. Hope that makes sense...
-Queue- Posted October 7, 2004 Posted October 7, 2004 You don't need to add the default null, since Case will return no result if neither test is true anyway.
Hijack Posted October 8, 2004 Posted October 8, 2004 Alrighty then. Didn't know that but then again, there's quite a bit I don't know.
Ugo DI LUCA Posted October 8, 2004 Posted October 8, 2004 And you can use GetField ( ) too, and also dynamically decide wether to sort ascending or descending. You can even slide and sort at the same time. However, all these neat calcs would be based upon unstored calcs, which, even with v7 (a bit better though), slow dosn the process. So, you'd better follow Ralph suggestion and switch layouts, unless you knwo the number of related records isn't that large.
Recommended Posts
This topic is 7352 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