Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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!

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.

  • Author

Thanks for your response, sounds good!

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...

You don't need to add the default null, since Case will return no result if neither test is true anyway.

Alrighty then. Didn't know that but then again, there's quite a bit I don't know.

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.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.