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

Activating buttons on specific dates

Hi all,

I'm building a Power App that includes buttons. When clicking the button, users should be taken to a designated screen.

 

I'd like for each button to be clickable only on a specific date, e.g. button 1 is clickable on December 1, button 2 on December 2, button 3 on December 3, etc.

 

If users click on the button before that specific date, they should receive a pop-up, telling them to return to the app later. If they click on it after that specific date, they should be redirected to the designated screen.

 

I'm struggling with writing a function for these scenarios. Would you be able to help me?

 

Thanks,

Anne 

5 REPLIES 5
gabibalaban
Super User
Super User

Hi @anne_danko ,

 

Include on OnSelect property of each button something similar to:

If(Today()>=DateValue("23.11.2020"), UpdateContext({viewPopUp:true}), Navigate(DesignatedScreen))

    - where viewPopUp is used to control the popup visibility.

To build a pop-up it is indicated to use a rectangle control in front of all others controls (to avoid accidental select of other controls) and a Label containing the message. Set the Visible property of both control to popUpView.

 

Also , you can control the option that the user have by using DisplayMode property and set it on each button to something similar to:

If(Today()>=DateValue("24.11.2020"),DisplayMode.Edit,DisplayMode.Disabled)

In this way all buttons before Today() will  be shown, but disabled.

 

Hope it helps !

I think  this solve also your issue

 

anne_danko
Microsoft
Microsoft

Hi @gabibalaban,

Thanks for getting back to me so promptly. I'm a complete rookie and still unsure about this part of the formula:

 

=DateValue("23.11.2020")

 

  • Is this the date I'm assigning to a particular button?
  • I read that the today function works with the local time of the user. If the user has a different time setting on their device, e.g. DD/MM/YYYY instead of MM/DD/YYYY, will this result in the button not working?

 

Thanks a lot for your help, it is much appreciated.

@anne_danko ,

 

1. Yes, you're right. The date is specific for every particular button.

2. Yes, you're right again. I'm from Europe. The button will still work, but the result of the function will not be as expected. 

Example: DateValue("23.11.2020")   in Europe:   23rd November 2020

                                                          in US:          11th November 2021.

 

anne_danko
Microsoft
Microsoft

Thanks a lot, @gabibalaban. I have one final question regarding the pop-up. Should the Visibility property be "popUpView" or "viewPopUp"? And where do I set the visibility property? 🤔

Uf ... i really messed up the post. Of course is the same variable.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,154)