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

Disable based on time

Hi there, 

I have a question for you, 

I have a button that patches information to a SP list, i would like for this button to be disabled based on time and maybe date 🙂 

I have tried to wickle my way around this, and have come up with this function/statement: If(Now()>Time(14;30;00);Disabled;Edit) the idea being that if the time has passed half 2 the button would be disabled, now PA doesn't complain about this statement but it also doesn't actually follow it, it just shows the button in edit mode no matter the timestamp? 

Has anyone got an idea of how to work around this issue, or maybe a completely different solution. 

Thanks in advance 
Best Wishes
Tobi 

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hey @Anonymous 

 

Can you try to update your expression as:
 
If(TimeValue(Text(Now())) > Time(14,30,00),Disabled,Edit)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

5 REPLIES 5
Pstork1
Dual Super User III
Dual Super User III

The problem is that you are expecting it to dynamically re-evaluate Now() in real time.  It won't do that.  It will evaluate your formula when the screen loads or at some other time depending on where you put it.  To get the kind of real time support you want I would suggest changing the formula to save a value in a variable.  Then use that formula in a Timer that runs on a cycle.  The variable value would be set on the completion of each cycle. Then enable or disable the button based on the value in the variable.

 

The problem with that design is that if you make the timer cycle too short it could really drain performance.



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

@Pstork1 

Would you happen to have any suggestions on how to achieve this, I have tried to do the best i can, but it does not seem to be working? 🙂 

- Tobi 

yashag2255
Dual Super User II
Dual Super User II

Hey @Anonymous 

 

Can you try to update your expression as:
 
If(TimeValue(Text(Now())) > Time(14,30,00),Disabled,Edit)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Anonymous
Not applicable

Yes of course! I feel like an idiot i have litteraly used this but because most forums and sites are from the US the syntax(seperators) are different, and it only occured to me now that that was the issue 🙂 

Thanks

Anonymous
Not applicable

@yashag2255  

Hi again, 

DisplayMode: If(TimeValue(Text(Now())) > Time(14,30,00),Disabled,Edit) definately works when it comes to the time a day, however, i am now looking to expand on this, i essentilly want the displaymode to be disabled if the time is within 14,30,00 on a specific day, 

I have checkboxes Monday through Friday, Monday should close of af 1430 on mondays, however Tuesday, Wednesday, Thursday, Friday should still be available to check off?? 

I thought you might have some input on how this might be achieved? 🙂 

- Tobias

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,407)