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 on document number doesn't work

Featured Replies

Hi,

I'm sorting a portal on Document Title, Document Author and Document Number. The sorting is done by clicking on column headers, using the script and calculated fields below. The problem is with the sorting on the document number. It does not really work as for instance, in ascending order, document number 786 displays before document 85. That's because the sorting is done on the first digit, so adding a zero in front of 85 would resolve the issue, but renumbering documents 1 to 999 is not an option. So based on my research, it looks like the solution to this (or at least one solution) would be for the sorting script to add three invisible 0 in front of document numbers 1 to 9, to add 2 invisible zeros in front of documents 10 to 99, and to add 1 invisible zero in front of documents 100 to 999. Documents 1000 and up will never be an issue as the database will never contain more 9999 documents.

Would anyone be kind enough to have a look at this and see what the best solution is, and explain how to implement it.

Thanks for your help.

 

Sort Ascending.PNG

Sort descending.PNG

Sort Script.PNG

Try:

SerialIncrement ( "0000" ; Number )

 

  • Author

Thanks, but where? In the script?

In the calculation fields you are using to sort the portal (at least I assume that's what you do - your post does not say so clearly). So instead of:

Case ( 
...
$$sort = "Number; ascending" ; Number ;

use:

Case ( 
...
$$sort = "Number; ascending" ; SerialIncrement ( "0000" ; Number ) ;

and likewise for the descending order field.

  • Author

Thank You very much. This was a brilliant solution.

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.