Show random count of data for Hard coded data in Native mobile page

Hi, In native mobile page, there are some hard coded data. From those data, I want to show only 6 data and that will be any random 6 data. How can I do that? Please let me know. Thanks,
1 answers

If this is data in the application and you have 100 records and want to randomly show 6 records out of this set of 100 records, you could try to use a nanoflow as data source.

The key here is to use the random function and make sure this returns a number between 1 and 100.

Once the number is created, make sure to keep track of the used numbers, for example in a non persistent entity or a variable with a character separated string. This can be used to prevent the same record to be chosen.

With the number you could create a loop to iterate over the list of 100 items to get to the object that is selected based on the generated number. Or perform a database retrieve using the amount and offset. Place the retrieved object in a list and repeat this action for 6 times (an additional loop around the previous one) and then return the list of objects in the end action of the nanoflow.

This way you have a function that will return 6 random items from your list of 100 items.

Hope this gives you an idea on how to implement this.