In this Power Apps tutorial, we will see, how to reset the Power Apps date picker with a few examples.
I recently received a requirement to reset a date picker control while working on Power Apps canvas apps.
Also, I will show you how to reset the Power Apps date picker control with the below things:
- How to reset a Power Apps date picker control to today?
- How to reset a Power Apps date picker control within the edit form?
- Reset a Power Apps date picker control within the edit form via an icon.
- How to reset a date picker control to blank within the Power Apps?
- Reset a date picker control to set the selected date within the Power Apps form.
- How to reset a date picker control to set the selected date within the Power Apps?
- How to reset a Power Apps date picker control after submission?
- How to reset a Power Apps date picker control to Now?
While working with the Power Apps date picker control, we can find the “Reset” function that will return control to its default state. Any changes made by the user are disposed of.
Controls within a Gallery or Edit form control cannot be reset from outside those controls. Controls from formulas on controls within the same gallery or form can be reset.
Keep reading this to get ideas on how to rest the Power Apps date picker control in different states.
Power Apps date picker reset to today
In this section, we’ll look at how to reset a Power Apps date picker control. We will use a button control to reset the preselected date within the Power Apps control and return the current date.
To work with this requirement, the following steps are:
- On the Power Apps screen, add a date picker control. It will display the current date (based on the timezone) within the control. As the ‘DefaultDate’ is set to Today().
- Add a button control to the screen. Rename it as Reset.
- Insert the below expression into the button’s OnSelect property.
OnSelect = Reset(DatePicker1)
Let’s preview the app and select a date from the Power Apps date picker control. We can see when we click on the button, it will reset the control and return the default date i.e., the current date.
This is how to rest a date picker control using a button control within the Power Apps.
Also Read: Power Apps Checkbox control within Gallery
Power Apps date picker reset in the edit form
In this section, we will see how to reset a date picker control inside a Power Apps edit form.
That means we will prepare a Power Apps edit form including a button. When the user clicks on the button control the edit form will reset as well as the date picker. To work with this scenario, the following steps are:
- We have a SharePoint list named Employees having EmployeeName(People column), Department(Choice), and JoinDate (Date and time).
- On the Power Apps, let’s build a Power Apps edit form and connect that form to the above SharePoint list as the source.
- Next, add a button control to the screen. Rename that control, suppose Reset Form. Insert the below expression on the Reset property.
Reset = ResetForm(Form1)
That’s it! Whenever the user selects a date from the date picker and clicks on the button the entire form will reset including the date picker.
This is how to reset a Power Apps date picker in the edit form.
Check out: How to use Power Apps Check Box Control
Reset Power Apps Datepicker in a form via an icon
In the previous example, we saw how to reset the form, including the date picker control, by clicking a button. We’ll look at how to use an icon to reset only a specific DatePicker control within an edit form.
For this, we are going to use the above Power Apps edit form which is attached to a SharePoint data source. The following steps are:
- On the edit form, select “Date Data Card“. Unlock it.
- Insert a Reset Icon to that data card shown below:
- Select the icon and insert the below expression on the OnSelect Property of the Reset Icon.
OnSelect = UpdateContext({VarResetdate: true}); Reset(DataCardValue3)
Where,
- VarResetDate: The name of the update context variable.
- DataCardValue3: The name of the date picker that is present in the edit form.
- Next, select the date picker control inside the form’s data card and insert the below expression on the DefaultDate property of the date picker control.
DefaultDate = If(VarResetDate, Blank(), Parent.Default)
As per the above expression, If the user clicks on the Reset icon it will display the current date; otherwise, it will display the user’s selected date.
- Next, select the edit form and insert the below expression on the form’s OnSucess, OnReset, and OnFailure properties. As a result, the default value will be shown every next time the form is opened.
OnSucess = UpdateContext({resetdate:false})
OnReset = UpdateContext({resetdate:false})
OnFailure = UpdateContext({resetdate:false})
Save and publish the app now. Then, close and reopen that app. As a result of the condition, the app will display the default date (i.e., blank). When we enter some data, including the date, and then click the reset icon, the specified date picker within the edit form, as shown below, is reset:
This is how to reset the Power Apps date picker in an edit form via an icon.
Read: How To Set Default Value in Power Apps List Box Control
Reset a Power Apps date picker control after submission
Here, we will see how to reset a Power Apps date picker control after the form submission.
That is when a user submits a Power Apps form, the date picker control within the form is reset. To work with this requirement, we are going to use the above example of the Power Apps edit form and the following steps are:
- On that screen, add a button control and give a name to the control as Submit and Reset.
- Insert the below expression on the OnSelect property of the insert the below expression using Reset().
OnSelect = SubmitForm(Form1);ResetForm(Form1)
Where Form1 is the name of the Power Apps edit form.
As per the above expression, it will not only reset the Power Apps date picker; but also, reset the entire form as well. Let’s preview this app and fill out the form. Submit the form by clicking on the button.
Also, we can see the data got submitted to the specified SharePoint list.
This is how to reset a Power Apps date picker control after the form submission.
Have a look: Power Apps Listbox items from SharePoint list
How to reset a date picker control to blank within the Power Apps?
We’ll look at how to clear a date picker control in Power Apps. According to the most recent requirement, when a user enters a date into the Power Apps date picker control and clicks the button, the date picker control is reset, a blank date value is displayed to the current date, and vice versa.
If this is the requirement, then the following steps are:
- On the Power Apps screen, add a date picker control and a button control to reset the control.
- Insert the below expression on the button’s OnSelect property.
OnSelect = UpdateContext ({ResetBlank:!ResetBlank})
- Insert the below expression on the date picker control’s DefaultDate property.
DeafultDate = If(ResetBlank, Blank(), Today())
Preview the app for now. Insert a date into the date picker control now. As we can see, the first click on the button resets the control to Blank, and the second click displays the current date, as shown below:
This is how to reset a Power Apps date picker from blank to the current date and vice versa.
Read: How to use Power Apps List box control?
Power Apps date picker reset the default selected date in the form
In this section, we’ll look at how to reset a Power Apps date picker control to a specific default selected date value.
We will create an edit form using a specific SharePoint list within the Power Apps screen that includes a date data card based on our requirements.
We will place a Reset icon on that edit form to reset the date picker and return a selected value within the Power Apps.
To work around this, the following steps are:
- On the Power Apps, we have built an edit form with a date picker control.
- Inside that date data card, insert a Reset icon.
- Put the below expression into the icon’s OnSelect property shown below:
OnSelect = UpdateContext({VarDefaultSelectedDate:true});Reset(DataCardValue3)
Where VarDefaultSelectedDate is the name of the update context variable name and DataCardValue3 is the name of the DateDataCard’s date picker control.
- Insert the below expression in the DefaultDate property of the DateCardValue or Date picker control.
DefaultDate = If(VarDefaultSelectedDate,Date(2022,12,25),Parent.Default)
Here, we have set the default date as 12/25/2022. That means when the user clicks on the icon, the control will reset to the specified selected date.
Let’s play the app. We can see once the reset icon clicks it will reset the preselected date to the default selected date i.e., 12/25/2022.
This is how to reset the Power Apps date picker’s preselected date to the default selected date.
Check: Power Apps combo box default value
Power Apps date picker resets the default selected date
There is another way to reset the Power Apps date picker control from a selected date to the default selected date.
For this, the following steps are:
- On the Power Apps screen, add a date picker control. We can see it will display the current date as the default date based on the time zone.
- Suppose, we will update the default date to a specific selected date. For this, set a date on the DefaultDate property as per the requirement shown below:
DefaultDate = Date(2022,12,31)
Where the above expression indicates the below date format:
Date(Year, Month, Day)
- To reset the date from the selected date to the default selected date, add a button control to the screen and insert the below expression on the OnSelect property.
OnSelect = Reset(SelectDate_DatePicker);
Where SelectDate_DatePicker is the name of the DatePicker control name.
Now it’s time to preview the app. Select a date from the date picker (11/11/2022) and click on the Reset button. We can see it will return the default selected date, i.e., 12/31/2022.
This is how to reset a Power Apps date picker to the default selected date.
Also read: Power Apps Combo box with SharePoint list
How to reset a Power Apps date picker to Now?
Similarly, we will see how to reset a Power Apps date picker control to now.
We have seen, usually, when we add a date picker control to the Power Apps screen, it will display today’s date as the default date.
But, here we will see the Power Apps date picker control will reset to Now. For this, the following steps are:
- On the Power Apps screen, add a date picker control and button control.
- Give a name to the button (i.e., Reset)
- Select the date picker control and insert the below expression on the DefaultDate property. As a result, it will display the date based on now.
DeafultDate = Now()
- Insert the below expression on the Reset property of the Power Apps date picker control. So, the date picker will reset to now whenever the user clicks on the button control.
Reset = Reset_Btn.Pressed
where Reset_Btn is the name of the button control.
Let’s play the app to see how it works. By default, it will display the date of now. Let’s select a date from the date picker (ex- 11/11/2022). When we click on the button, it will reset and display the date of now.
This is how to reset a Power Apps date picker to Now.
Furthermore, you may like some more Power Apps Tutorials:
- Power Apps Filter With Date Picker
- How To Set Default Date in Power Apps Date Picker
- How to Patch Power Apps Date Picker
- [Solved]Can’t convert this data type. Power Apps can’t convert this Date to a Boolean
- Power Apps combo box filter
- How to Patch Power Apps Combo Box
- How to Sort Combo Box Items in Power Apps
- Power Apps combo box with Office 365 users
- How to use Power Apps Combo Box Control?
- How to Reset Power Apps Combo Box
Conclusion
From this Power Apps Tutorial, we learned how to reset the Power Apps date picker control based on different kinds of scenarios. Such as:
- Power Apps reset the date picker control to today
- Power Apps date picker control reset within the edit form
- Power Apps date picker reset within the edit form via an icon
- Reset a date picker control to blank within the Power Apps
- Reset a date picker control to the default selected date within the Power Apps form
- Power Apps date picker reset to set the selected date
- Power Apps date picker control after submission
- Reset a Power Apps date picker control to Now
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Out audiences are from the United States, Canada, United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a SharePoint MVP(8 times), check out My MVP Profile. I have also worked in companies like HP, TCS, KPIT, etc.