Skip 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.

Sort in a Script

Featured Replies

Now this should be easy, but I can not figure out a work around.

Here is the simple problem, I need to have a simple script that sorts, BUT I do not want all fields from the table displayed.

If you do sort manually, you have the option of using only the current layouts fields, but this is not available in the script step.

Any ideas?

A script that sorts is often referred to as a "hard-coded" script, in that the developer specifies the fields that are sorted in the Sort script step and turns off the Show Dialog. The user doesn't see any choices. Adding modularity to this type of script requires sending a parameter to the script, and using If ElseIF EndIF structure.

Can you expand on what you're trying to accomplish?

btw, here's a demo that I did a while ago that includes column headers in a list view that sort. Link

  • Author

normally I would prescript all my sort request. I have users that are requesting an easier way to sort. To ease the sorting, I wanted to make a script that limited the amount of available fields to sort by. I was going to make a layout with the available fields, script it to go to that layout, and sort.

The current table has 102 fields, and 98% are useless for my user group for sorting.

Also, I have a lot of the functions turned off with a custom menu, because of data security and to not confuse the user. Users prefer buttons.

Well, you could have a list of "field names" (valuelist) by which to sort (attached to gSort). Then, using a script trigger attached to gSort, call a sort script that has the conditional structure I describe above.

  • Author

Thanks. Let me see if I understand, and expand on it a bit.

Lets say we have three field we want to sort by. I set up three global sort fields. Each global field is then tagged to a value list with fields that are the options to sort by.

We also have three calc fields that are equal to field data we are sorting by. This is dynamic. Change the global value, it will change the field value based on what you choose.

Then you hard code the script to sort by the first calc field, then the next calc, and then the last calc.

I like it......

The current table has 102 fields, and 98% are useless for my user group for sorting.

Well, that would leave only 2.04 fields to sort by. :P

Anyway, even with 3 or more fields, it's not likely that all possible combinations will make sense when sorting. Usually there is only a relatively small number of useful sort orders - so your script can have multiple (hard-coded) Sort Records[] steps and choose between them according to the script parameter.

  • Author

I have it made up and it works great, but ran into another snag.

Some fields are numbers and some fields are text. In the calc filed if I specify number, it messes up the text, if I specify text, it messes up the number.

Any ideas....

  • Author

I figured it out. Instead of one calc field Dependant on the value list, I made two. One if for text and one for number. Only one of the two will be calculated. The sort then goes:

gSort1 (Text)

gSort1 (Number)

gSort2 (Text)

gSort2 (Number)

gSort3 (Text)

gSort3 (Number)

Hope this helps someone else later on down the road....

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.