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.

sorting in portals

Featured Replies

I find it interesting that in FM7 you can define a sort sequence when defining a relationship and then define another when use the relationship in a portal. I would like to take advantage of that latter feature and change the sort sequence in a portal somehow within a script. Otherwise I believe I would need to have a different layout for each sequence I would like to display the data in.

I want the user to be able to toggle through different sequencing options of the portal with the click of a button.

Is there a way to change the sort sequence of a portal from within a script (without user interaction other than the 'toggle' button)?

TIA

Tomp

Hallo Tomp,

That is my problem also, i have created 2 buttons, first button for sort order by first field and second button for sort order by second field, so what script can do that without create other layout ?

Can all help me ?

Hallo Tomp,

That is my problem also, i have created 2 buttons, first button for sort order by first field and second button for sort order by second field, so what script can do that without create other layout ?

Can all help me ?

Hallo Tomp,

That is my problem also, i have created 2 buttons, first button for sort order by first field and second button for sort order by second field, so what script can do that without create other layout ?

Can all help me ?

The easiest way is to create two layouts. If this is not an option you could create another field that is a calculation that you could perform the sort with. Have the calculation depend upon a value in a global that a script can change, triggering a different sort schema.

The easiest way is to create two layouts. If this is not an option you could create another field that is a calculation that you could perform the sort with. Have the calculation depend upon a value in a global that a script can change, triggering a different sort schema.

The easiest way is to create two layouts. If this is not an option you could create another field that is a calculation that you could perform the sort with. Have the calculation depend upon a value in a global that a script can change, triggering a different sort schema.

Thank you dkemme,

I have tried to create global field for saving sort option values and calculation field for select value to sort, but sorting still can't switch, if i display calculation fields values is true, why that can't switch ?

Thank you dkemme,

I have tried to create global field for saving sort option values and calculation field for select value to sort, but sorting still can't switch, if i display calculation fields values is true, why that can't switch ?

Thank you dkemme,

I have tried to create global field for saving sort option values and calculation field for select value to sort, but sorting still can't switch, if i display calculation fields values is true, why that can't switch ?

You have to change the value of one of the portal records for the sort to be updated in the portal. You can do this by script, such as:

Set Field [portalField ; portalField & " "]

Set Field [portalField ; Trim ( portalField )]

Commit Records [no dialog]

It won't work automatically without the commit step.

You have to change the value of one of the portal records for the sort to be updated in the portal. You can do this by script, such as:

Set Field [portalField ; portalField & " "]

Set Field [portalField ; Trim ( portalField )]

Commit Records [no dialog]

It won't work automatically without the commit step.

You have to change the value of one of the portal records for the sort to be updated in the portal. You can do this by script, such as:

Set Field [portalField ; portalField & " "]

Set Field [portalField ; Trim ( portalField )]

Commit Records [no dialog]

It won't work automatically without the commit step.

  • 4 weeks later...

I use a global field to trigger the sort criteria what works fine (all in 1 layout with buttons). I use the Refresh Window Script step (and flush cashed join results) to commit the records' sort order.

But in my case there's another problem coming up:

I'd like to sort either by date or by name, but as my global sortFiled itself has to be of a certain type (in my case text) it's not sorting correct if you choose to sort by date, because it's treated like a text field...

Is there any way to change the field type of one field dynamically (means if you want to sort by name...field type is a text-field, otherwise by date it's a date-field) to make this work?

I just figured out was I was asking...if anyone else got the same problem:

Use the GetAsNumber function to transform the date into the right format...should work!

Hi,

The Date & ""

The Hour & ""

works equally.

You may want to check EasyPortalSortUS.fp7 as it has a calculation which allows to sort whatever type of fields you'd be dealing with would it be text, hour, date or numbers, and whatever sort you decided.

HTH

  • 3 months later...

Ugo

I just tried your EasyPortalsort. It looks fabulous!

However, dosn't work for me in my solution.

I got the buttons to work, so that the gParameter changes values 1, -1, 2, -2 etc.

I also got the SortKey to change values based on the buttons.

But try as I might, the portal won't resort!

Any suggestions?

Jerry

The example is based on a self join. In the case of a classic portal, you might consider using a Refresh Window script step with flush cache etc.

If you still have issue with it, contact me directly to see what your settings are compared to the example file.

HTH

  • 3 weeks later...

Anyone know what hoops I have to jump through in FMP 6v4 to get a portal that is sorted on a calculation (using getfield) to refresh?

If I allow entry into the portal fields, I can get it to refresh with a simple "go to portal row (last)" script step followed by "go to record/request (select)" with no record. But the moment I block entry into the portal fields, it goes buggy!

Any clever hacks out there?

got it to work with a simple

enter preview mode[]

enter browse mode[]

Sometimes, but not always, you can avoid the Preveiw/Browse switch trick by instead refreshing the screen with a Freeze Window step.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.