Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

OnChange of Date Picker, only applies to the first change

(0) ShareShare
ReportReport
Posted on by 909 Super User 2024 Season 1

Hi,

 

i have this in my onchange property of a date picker

 

If (
DataCardValue39_1.SelectedDate > Today(), 

UpdateContext({ResetDatePicker: true}),
UpdateContext({ResetDatePicker: false})
)

 

which works nicely! however if I try it a second time affter the initial reset, it doesnt reset the date picker.

 

Anyone know why?

  • LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: OnChange of Date Picker, only applies to the first change

    @wonka1234,

     

    I am unable to recreate the issue on my end. A possible explanation as to why the DatePicker will not reset is that the variable is still set to true during the second attempt. Should the variable be shared amongst other controls (that may not set it back to false) - this could explain the issue.

     

    Should you prefer to use a variable instead of the Reset approach above, I would recommend placing both the true and false update within the true section of your If statement:

     

    If(
     DataCardValue39_1.SelectedDate > Today(), 
     UpdateContext({ResetDatePicker: true}); UpdateContext({ResetDatePicker: false})
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Verified answer
    LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: OnChange of Date Picker, only applies to the first change

    Hi @wonka1234,

     

    Should the reset be limited to the current DatePicker control you could use the following code (variable is not needed):

    If(
     Self.SelectedDate > Today(),
     Reset(Self)
    )

     

    I hope this helps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard