cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Make something visible if it‘s 10 o‘clock

I wanna make my label and Icon visible, if it‘s 10 o‘clock. How can I do this?

1 ACCEPTED SOLUTION

Accepted Solutions

As I mentioned above, the only way to do that is to have a timer control that re-evaluates the current time on some interval.  When the time falls within a time period then run the formula to set the variable or populate the collection.  The trick is that if the interval for the timer is too short your performance will degrade, because it keeps doing something to the timer.  But if the interval is too long then the timer may not catch the timeslot you want.

 

So as a test.  Add a timer to the app, set Autostart too true and Set repeat to true. Set the duration to an appropriate Interval.  The default is 60,000 which is 60 seconds.  300,000 would be a good starting number (5 minutes). In the timer set OnTimerEnd to your formula.

If(Hour(Now()) = 10 && Minute(Now()) <= 5,Set(displaycontrol, true),Set(displaycontrol, false))

Then set the visible property of the control to displaycontrol.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

View solution in original post

6 REPLIES 6
Adrian_Celis
Super User
Super User

Hi @Anonymous 

 

Do you want to show the label and icon from 10:00am to 10:59am?

You can use this formula in the Visible property of your label and icon:

Hour(Now()) = 10

 

If the app is refreshed in that time period the label will show.  But that formula won't be re-evaluated unless something resets the control.  If you enter the page at 9:59 the label will continue to be hidden until you leave and re-enter the page or reset the control.  You would need a timer that is continually checking the time to get it to change visibility spontaneously.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

Anonymous
Not applicable

@Adrian_Celis Hi, that‘s great, and if I I want to make a collection at 10:00, how can I do this?

Hi @Anonymous 

Did you mean you want it to happen at 10:00 and then end at 10:01?

Add a Minute function to the formula

 

Hour(Now()) = 10 And Minute(Now()) = 0
Anonymous
Not applicable

@Adrian_Celis That was my first question, but how can I start an action if it‘s 10 o‘clock?

As I mentioned above, the only way to do that is to have a timer control that re-evaluates the current time on some interval.  When the time falls within a time period then run the formula to set the variable or populate the collection.  The trick is that if the interval for the timer is too short your performance will degrade, because it keeps doing something to the timer.  But if the interval is too long then the timer may not catch the timeslot you want.

 

So as a test.  Add a timer to the app, set Autostart too true and Set repeat to true. Set the duration to an appropriate Interval.  The default is 60,000 which is 60 seconds.  300,000 would be a good starting number (5 minutes). In the timer set OnTimerEnd to your formula.

If(Hour(Now()) = 10 && Minute(Now()) <= 5,Set(displaycontrol, true),Set(displaycontrol, false))

Then set the visible property of the control to displaycontrol.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,759)