cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Derek5
Microsoft
Microsoft

Every 5 seconds to display a random single digit

HI Gurus, 

 

Spent about 12 hours but not figuring out how to achieve this. Hope you can help.

I am writing a simple app to display a single digit (1-9) on the label every 5 seconds. So I use a time control and use Rand function. 

I setup the label.text as below (Interval =5000)

If(Timer3.Value/Interval<1, 2,If(Timer3.Value/Interval<2, 7,If(Timer3.Value/Interval<3, 1, If(Timer3.Value/Interval<4, 9, If(Timer3.Value/Interval<5, 6, If(Timer3.Value/Interval<6, 8, 5))))))

I wanting to put Round(rand()*10, 0) in place instead of now the static values like 2, 7, 1,....

However when I do, every single milli-second, it trigs the rand function and my label you can imagine keeps changing/flashing.

 

Any good idea we can achieve this simple request? Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
VijayTailor
Resident Rockstar
Resident Rockstar

Hi @Derek5 

Please find the attache app for your requirement.

Steps 1  - Select the Screen and Set the Onvisible Properties - 

UpdateContext({RestartTimer:true});

Step 2 - Add the Timer Control and and set the OnTimerEnd Properties like below.

UpdateContext({RestartTimer:false});
UpdateContext({RandomValue:Round(Rand()*10, 0)});
UpdateContext({RestartTimer:true});

Step 3- Set the Timer AutoStart Properties like below

RestartTimer

 

Thanks,
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

2 REPLIES 2
VijayTailor
Resident Rockstar
Resident Rockstar

Hi @Derek5 

Please find the attache app for your requirement.

Steps 1  - Select the Screen and Set the Onvisible Properties - 

UpdateContext({RestartTimer:true});

Step 2 - Add the Timer Control and and set the OnTimerEnd Properties like below.

UpdateContext({RestartTimer:false});
UpdateContext({RandomValue:Round(Rand()*10, 0)});
UpdateContext({RestartTimer:true});

Step 3- Set the Timer AutoStart Properties like below

RestartTimer

 

Thanks,
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

it is awesome. 

thank you so much.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,626)