The data of the template grid is displayed randomly on the page

I want to make a template grid where data can be displayed randomly. Every time I refresh the template grid, it will re-grab the data and display it randomly. How can I do this and is Mendix allowed?  
2 answers

Hi Yi,


I think you can do the following:

  1. On the entity you show on the template grid create a decimal attribute called ‘Sorting’
  2. Create a microflow to open the page with the template grid
  3. In this microflow loop over all objects you want to show in de templategrid
  4. Use a change object in the loop. Change ‘Sorting’ and set the value to: random()
  5. On the page sort the template grid on ‘Sorting’ attribute
  6. Create a refresh button that loops over all objects and sets ‘Sorting’ to a new value.

The data will now be shown in a random order everytime.

Hope this helps!


Hi Yi Tsen,

If you want to randomize the data that you are displaying in the template grid, you could use an already existing Marketplace Module called Fake Data.

I think you could use that module to generate/update the random data into the attributes that you will be displaying in your template grid. You probably will need to set a microflow call for scrambling the data first and then an Open Page action (or you could have a “refresh” button to scramble the data everytime you want different data).

I hope that helps you with your question!