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.

How to sort a table based on a variable field name using a script

Featured Replies

Hello,

I have a typical row/column portal with labels as column headers.  I want to be able to click on a column header (a text grouped button) and pass the associated field name to a script that then sorts by that field.  I don't see a "Sort Records" or Sort Records by Field"  that supports a variable name for the field.  I notice that Sort Records by Field will use the currently active field if no field is provided - but I can't figure out how to "activate" the field using a variable.  I tried "Go To Object" where the variable is the Object name but I get an error [3] Command is unavailable.  This seems like it should be easy and I can brute force it with a case type structure but that feels really clumsy.  Anyone know a better approach?

Thanks

32 minutes ago, BAleiHi said:

how to "activate" the field using a variable.

Using an object name is one option. Hard to say why it didn't work for you without seeing exactly what you did.

Another way is to use the field name and loop among the fields until it matches.

And there is also the simple (albeit verbose) method of using If[] and multiple Else If[] steps, each with a hard-coded Sort Records step.

 

  • Author

Thank you,

I ended up just using the If/multiple Else Ifs option (Case statement) to avoid the hassle of figuring out a more elegant way.  It makes the code much more readable which is nice but I feel like I'm back in Coding 101 doing it that way.  Oh well.

 

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.