How to randomly sort entities in List view?

0
I would like to see the objects in different order each time the list view page is accessed. I wonder if there is a way to do it by calling a microflow? Thank you in advance. 
asked
2 answers
2

Alternative to Shekhar's solution would be to add a “sortorder” attribute to your entity and sort by that attribute.

You would fill the attribute randomly in your datasource microflow. This means that your table will always be randomly sorted rather than sorted by one of the attributes in your list.

answered
1

Yes, Call a workflow and retrieve the data into a list. Depending on how many sorting options you have, you will need to create that many branches. You will need to generate a random integer using the formula below:

SortOrder= Math.floor(Math.random() * (max - 1)) + 1

 

So if you have 5 fields to choose from for sorting use the formula:

SortOrder= Math.floor(Math.random() * 4) + 1

 

Now based on your SortOrder, If SortOrder is 1, Use the List Operation “Sort” with the field which is first in the list, similarly is the SortOrder comes across as 2, use a separate branch and Use the List Operation “Sort” with the field which is second in the list, as so on.

If you need any further help, do let me know.

Regards,

Shekhar

answered