I need that when the user press the button, the app show one aleatory line of the my Excel.
You will need to incorporate the Rand function to do this.
You can use a Formula such as this:
yourDataSource, RoundDown(Rand() * (CountRows(yourDataSource) +1) + 1, 0)
I hope this is helpful and gets you to the next step.
Hi @Haufe ,
Do you want to display one Random row of your Excel table within your app when you press the button?
Based on the needs that you mentioned, I think the Shuffle function and First function could achieve your needs. The Shuffle function used to randomly reorder the records of a table.
Please take a try with the following formula within your app:
On your side, please take a try with the following workaround:
Set the OnSelect property of the Button to following:
Add a Data table control, set the Items property to following:
More details about Shuffle function and First function, please check the following article:
Now there's a function I had forgotten about...Shuffle! Good one.
Thank so much for your answer.
I did everything but didn't work, does not show anything in the data table.
OnStart = Collect(RandomRecord ; First(Shuffle(Table1)))
Items = RandomRecord
OnSelect = ClearCollect(RandomRecord; First(Shuffle(Table1)))
Hi @Haufe ,
Could you please share a screenshot about your issue?
I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:
Please check if you have enabled proper fields to display within the right Data Fields panel (as the first screenshot mentioned).
More details about enabling display fields in Data Table control within Fields panel, please check the following GIF screenshot:
If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.
Hi @Haufe ,
I could not reproduce your issue on my side. Please check if the Collection1 that you initialized in your app is populated with proper values after you click the Button.
Please go to File-> Collections, then check if the Collection1 variable that you initialized within your app is populated with proper values. If not, please consider re-create a new connection to your Table data source, then try your formula again, check if the issue is solved.
In addition, please consider take a try to add a Label control in your app, set the Text property to following:
check if Label could display proper value.
You could also consider use Gallery to display your record instead of using Data Table control. The screenshot as below:
On your side, please set the Items property of the Gallery to following:
If the issue still exists, please consider take a try to re-create a new app, try your formula again, check if the issue still exists.
Unfortunately does not work, i did everything like told me.
I created another app, update my conection with the table, and saw about the collection, but the same thing .
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Did you miss the call? Check out the Power Apps Community Call here.
We are excited to announce the Power Apps Super Users!
Check out our new profile badges recognizing authored solutions!