I have a table with 2 columns. I need to display a random cell from the first column and a second cell from the other column.
I have no idea to do so.
I already do the random choice with a formula in excel so I only need to display it but I read that it's impossible. Maybe we can make the random choice inside powerApps.
Solved! Go to Solution.
To refresh the random record, you would set a variable to random record by adding a button and setting the OnSelect property to the following:
Set(varRandom; First(Shuffle(Tableau1)) )
You would then set your label text to
You can then click the button to refresh the random name.
you can use the Rand() function. This is chooses a number between 0 and 1, so if you have 100 rows you can do something like:
This is would give a random whole number between 0-100.
Then you can use First() and Lastn() to get that row.
Something like this:
First(Lastn(your excel connector ,int(100*rand()))).column
Yup! Just do another ".Value" on the end to get the text value. It might be something other than .Value, start typing "." And see what options show up.
An alternative to @DylanSimons's answer would be to call the Shuffle function. This function randomly reorders the records of a table.
The syntax would look like this:
@timl Your solution is great, I think I almost succeed but there is still a problem : it said "blank" while it isn't.
look at the pictures.
I don't really know, I only click on "text label", then I replace ' "text" ' by @timl 's istruction.
I think I write the formula on both. (Look at the pictures please)
This is strange because your formula looks correct.
To diagnose this further, if you omit the Shuffle function, can you confirm whether you can retrieve the first prénom value with the following function?
One other thing to try would be Filter the result of Shuffle to return non blank values.
First(Filter(Shuffle(Tableau1); prénom <> "").prénom
Well done ! The formula is correct because with your test I've the same problem. It's really weird. My table is ok (it's not "tableau1" but "TableauNom" but it doesn't work anyway). I will learn one more time how to create an excel table 😅
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.