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 Portals with Calc field

Featured Replies

Hi,

I can't find out where I'm going wrong here ... I'm sure it's quite simple.

I have a self-relationship. I want to be able to change the sort order of a Portal, via scripts. To this end I've made a calc field, based on a global set-field and the sort order is from the calc field. The fields and scripts all work as they should, both when inside and outside the portal.

BUT ... the calc doesn't refresh, so the sort isn't effected.

Opening and closing the calc field's definition in :) Define Database, forces it to refresh ... so I *know* the logic is okay, but I can't find any script steps, to make it work.

I'm working in FM8 Advanced and don't really want to have to make a separate file just for this.

Can anyone tell me how to force refresh a calc?

(BTW ... there seems to be too many places to set the sorting prefs for a Portal. In the Portal itself and in the Relationship dialog. What's the difference and why do we have so many options? And ... which one 'wins' if we set the all??)

Many thanks for any pointers!

Grant

I am not sure if this would be the right solution. In your script where you assign value to the global field, try using the exit record/request script step which updates field data and making no field active.

1. Wrap your script with these two steps:

Freeze Window

<>

Refresh Window [ Flush cached join results ]

2. Portal sort order overrides the relationship's sort order. Portal sort order is local - it affects only the specific portal on the specific layout. A relationship's sort order is general - for example, if a calculation relies on an ordered relationship, it will be evaluated using the relationship's sort order.

  • Author

Hi Sanjai,

thanks for the reply.

That script step doesn't exist in FM8 (not in my copy anyway :) ), but I've tried the 'Commit Record' step and it doesn't work. I've tried pretty much all the obvious script steps ... even 'flush cache'.

Seems there must be some way of doing this, other than having the whole thing in an external file?

Grant

  • Author

Excellent!!

Thanks ... errr... Mr Comment

I spent a lot of time this afternoon, fiddling around with various permutations, tried both of those steps, but not together. Still ... I learned some other stuff. Which brings me neatly to ... thanks for the explanation of the sorting prefs. :)

So much to learn, so little time. (I remember when it used to be ... so many girls to kiss, so little time. Ho hum. )

Grant

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.