Random and Limit!

Hiya - I’m trying to randomise and limit a sheet to the top 10 or so records. I’d created a virtual column using Randombetween(1,99999), the idea being that i could then only return the top n rows each time

However, the virtual column seems to be the same for each row! What am i doing wrong? Cheers

Solved Solved
0 8 308
  • UX
1 ACCEPTED SOLUTION

I’m not sure it’s possible. I’ve noticed, too, that RANDBETWEEN() seems to return the same random number for the same arguments when the expression is evaluated across many columns at once. You could try varying the arguments:

(RANDBETWEEN([_ROWNUMBER], (999999 + [_ROWNUMBER])) - [_ROWNUMBER])

View solution in original post

8 REPLIES 8

can anyone give me a hand with this? I’m a little wet behind the ears with it!

So, i have a single table of data. I want to be able to display 10 or so rows randomly from that data in a list. How can I do that? When I try randombetween i get the same number on each row in the app. I want to use this virtual column to sort the data, and potentially limit the data to only 10 rows.
thanks for any help!

I’m not sure it’s possible. I’ve noticed, too, that RANDBETWEEN() seems to return the same random number for the same arguments when the expression is evaluated across many columns at once. You could try varying the arguments:

(RANDBETWEEN([_ROWNUMBER], (999999 + [_ROWNUMBER])) - [_ROWNUMBER])

hi steve,

do you mean that randbetween() may not correctly randomize? I’d like to randomize the order of ten images in a gallery ux, and tried different suggestions in other posts for more complicated random solutions, but i can’t seem to get just a basic random function to work.

any help or suggestions is really appreciated, thanks!

“Correctly” is subjective. Did you read my post above?

thanks for your quick reply! i did read your post and the others about randomizing with more requirements, so apologies for not quite understanding. my table has three rows (id, name, url), and i’d like to randomize the order of the rows in the gallery ux. is there a basic expression and where exactly would it go in order to be able to do that? thanks again for your help.

I’d suggest you try the expression I gave above:

Let us know if that works for you.

ah wonderful! that does it! Cheers

Thanks Steve, that works!