Use the AddColumns function to add a new column to your collection with a random value for each record. ClearCollect(
colWithRandom,
AddColumns(
colOriginal,
"RandomValue",
Rand()
)
);
Use the Sort function to sort the collection by the RandomValue column. ClearCollect(
colSortedRandom,
SortByColumns(
colWithRandom,
"RandomValue",
Ascending
)
);
Use the FirstN function to select the desired number of random records. ClearCollect(
colRandomSubset,
FirstN(
colSortedRandom,
10 // Replace with 5, 30, or any other number
)
);
Set the Items property of the gallery to the colRandomSubset collection: Items: colRandomSubset
--------------
If you want the user to dynamically specify the number of records (e.g., 5, 10, or 30):
ClearCollect(
colRandomSubset,
FirstN(
colSortedRandom,
Value(TextInput_NumRecords.Text) // Use the value from the input
)
);
hope this helps.