Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Way to random sort records?

7988 12
cancel
Showing results for 
Search instead for 
Did you mean: 
Bryan_Murley
4 - Data Explorer
4 - Data Explorer

Is there a way to sort the records randomly (not alphabetically)? Say I have a table of students and I want them to be randomly ordered for a presentation or something?

12 Replies 12
Joachim_Brindea
6 - Interface Innovator
6 - Interface Innovator

You can never achieve true randomness natively with a formula but here is what I use:

MOD(
  (FIND("0", RECORD_ID()) * 11.5 + FIND("1", RECORD_ID()) * 23.21 + 
   FIND("2", RECORD_ID()) * 37.12 + FIND("3", RECORD_ID()) * 49.49 + 
   FIND("4", RECORD_ID()) * 59.89 + FIND("5", RECORD_ID()) * 67.52 + 
   FIND("6", RECORD_ID()) * 73.96 + FIND("7", RECORD_ID()) * 89 + 
   FIND("8", RECORD_ID()) * 97.54 + FIND("9", RECORD_ID()) * 101.14 +
   VALUE(DATETIME_FORMAT(CREATED_TIME(), 'MMDDHHmmssSSS')) * 13.89 +
   VALUE(DATETIME_FORMAT(LAST_MODIFIED_TIME(), 'MMDDHHmmssSSS')) * 17.25),
  1000000
) + 1

The output is a random number (only a dozen duplicates amongst a list of 10k records in my testings).

I then sort by that column and voilà.

This is a clever solution.  Thanks for sharing.  Unfortunately, my use case requires the field to be randomized upon each page load, rather than one time and then it becomes static.

Cabhorn
5 - Automation Enthusiast
5 - Automation Enthusiast

Random sort needed! Feature request