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.

Need a tweak for portal sorting within a script

Featured Replies

Howdy, howdy:

 

I found a neat way of performing a sort within a portal (in the attached file), but I'm stuck trying to amend one of its scripts' steps: in the setPortal_refresh [field] script, line 7, it has:

ExecuteSQL( "SELECT ID from Contacts WHERE State = ? ORDER BY " & $field & Case ( $$sort_desc; " DESC" ); ""; ""; States::abbreviation )

The thing is, I want to exclude referencing a state--I just want to be able to sort each column's contents, state notwithstanding. I tried removing the WHERE part of the code but I'm just not getting the syntax right. How would I tweak the syntax to accomplish my goal...or by tweaking the syntax it would cause the portal sort script to fail?

As always, TIA for your help.

Cheers,

Rich

 

Portal_sort_fast12.fmp12.zip

If I am not mistaken, the syntax would be:

ExecuteSQL( "SELECT ID from Contacts ORDER BY " & $field & Case ( $$sort_desc; " DESC" ) ; ""; "")

I am not sure why you would want to exclude the WHERE clause, though. Its purpose is to reduce the selection to the records shown in the portal. If you remove it, you will be sorting all records in the Contacts table and present the sorting field calculation with a much larger list. I don't think it will affect the final result*, but it will add unnecessary complexity to the process.

--
(*) Caveat: I only glanced at the file and I could well be missing some finer point.

 

  • Author

Thanks again, and that's a good point about sorting through all the records in table; I'll have to re-evaluate the solution before I put my foot in it.

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.