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.

Tricky portal sorting wanted...

Featured Replies

I have a portal that users want to see items in the added record order (sorted by ID field), newest item on top. No problem... But then later re-Sort it by a color field to bunch like colored items to together.

I can't seem to figure out a way to dynamically allow users to toggle the portal's sort between the ID field and Color field

Anyone have a clever trick? Is there a way I'm not seeing?:)

Many thanks....

Dave

Is Color field a Container field or a text or number field? If it's a Container, you'll need to make it another kind, because you can't sort on Containers.

There's two schools of thought on this.

One is to create an unstored calculated field in the table that contains either the ID field or the Color field depending on what the user selects (usually adding a global field for the user selection). Set your portal to sort on this new calc field.

The other school of though is to make two portals each sorted differently and put them on different tabs, but lined up so you can't tell the difference. Take away all the borders from the tab and label each tab ID and Color respectively.

  • Author

I was thinking along the same lines, just didn't have it quite right! I hate having to create another layout for the sake of the portal sorting! So here's what I came up with. Hopefully it's helpful to others....

Thanks

Dave

In the line items table:

Created a global field called "LineItemSortOrder"

Then created an unstored calculation field in my with: "ItemSortOrder"

If ( Ord::LineItemSortOrder="Entry Order" ; ID ; ItemColor )

Then added the following script to my Parent table to toggle between the two sorts.

Go to Related Record[show only related records; From Table:Orders: Using Layout: ]

IF [Orders::LineItemSortOrder="Entry Order"]

Set Field[Orders::ItemSortOrder; "ItemColor"]

Sort Records [Restore; No Dialog]

Else

Set Field[Orders::ItemSortOrder; "ID"]

Sort Records [Restore; No Dialog]

End IF

Refresh Window[]

I added the Sort Record[] to each IF statement to toggle between ascending and descending..

I'm glad I could help, but I don't understand what you're trying to do any more. Neither technique I described above requires a script.

Are you sorting a portal or a found set of records? Sorting a found set does nothing to the sort order of a portal which is determined by the sort order of the relationship superseded by the sort order defined in the portal itself.

I don't think your script is doing anything - you cannot sort records in a portal by a script.

Sorting a portal by a calculation field is problematic, especially when the fields are of different type. I don't think there are "two schools of thought on this" - the introduction of tab control in version 8 has made the other method obsolete.

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.