cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
King
Level: Powered On

randomly select the element of a field

I have a list which is called users in it I have a field called name and another called mail

I need that with a button of powerapps randomly choose one of these users and show the name and email in labels

to make me understand it's a raffle

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: randomly select the element of a field

Hi @King 

You could use the Shuffle function to do this. This function randomly re-orders a table.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-shuffle

In the OnSelect property of your button, you can store the first record of the shuffled table in a variable.

Set(RandomRecord, 
First(Shuffle(Users))
)

On your labels, you can use RandomRecord.Name and RandomRecord.Email to display the fields.

View solution in original post

1 REPLY 1
Super User
Super User

Re: randomly select the element of a field

Hi @King 

You could use the Shuffle function to do this. This function randomly re-orders a table.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-shuffle

In the OnSelect property of your button, you can store the first record of the shuffled table in a variable.

Set(RandomRecord, 
First(Shuffle(Users))
)

On your labels, you can use RandomRecord.Name and RandomRecord.Email to display the fields.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Platform 24

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (4,251)