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
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
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")
Thanks a lot for your help, it is much appreciated.
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.
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.
User | Count |
---|---|
124 | |
87 | |
86 | |
75 | |
69 |
User | Count |
---|---|
214 | |
181 | |
140 | |
96 | |
83 |