How to Reset Power Apps Date Picker

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.
Power Apps date picker reset
Power Apps date picker reset
  • Insert the below expression into the button’s OnSelect property.
OnSelect = Reset(DatePicker1)
PowerApps date picker reset
PowerApps date picker reset

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).
Power Apps date picker reset in form
Power Apps date picker reset in the form
  • On the Power Apps, let’s build a Power Apps edit form and connect that form to the above SharePoint list as the source.
Power Apps date picker reset in an edit form
Power Apps date picker reset in an edit form
  • 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)
PowerApps date picker reset in form
PowerApps date picker reset in the form

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.

See also  How to format a currency column in Power Apps?

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:
Reset Date in Power Apps Datepicker in a form via icon
Reset Date in Power Apps Datepicker in a form via the icon
  • Select the icon and insert the below expression on the OnSelect Property of the Reset Icon.
OnSelect = UpdateContext({VarResetdate: true}); Reset(DataCardValue3)

Where,

  1. VarResetDate: The name of the update context variable.
  2. DataCardValue3: The name of the date picker that is present in the edit form.
Power Apps date picker reset in edit form via icon
Power Apps date picker reset in edit form via the icon
  • 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.

Reset a Power Apps date picker control via icon in a form
Reset a Power Apps date picker control via an icon in a form
  • 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})
Power Apps reset only Date Picker in the form
Power Apps reset only Date Picker in the form

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:

Reset the Power Apps date picker in an edit form via an icon
Reset the Power Apps date picker in an edit form via an icon

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.

Reset a Power Apps date picker control after submission
Reset a Power Apps date picker control after submission

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.

Power Apps date picker control reset after submission
Power Apps date picker control reset after submission

Also, we can see the data got submitted to the specified SharePoint list.

PowerApps date picker control reset after submission
PowerApps date picker control reset after submission

This is how to reset a Power Apps date picker control after the form submission.

See also  Power bi gauge chart - How to use with examples

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})
Power Apps date picker reset to blank
Power Apps date picker reset to blank
  • Insert the below expression on the date picker control’s DefaultDate property.
DeafultDate = If(ResetBlank, Blank(), Today())
Reset Power Apps date picker to Blank
Reset Power Apps date picker to Blank

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:

PowerApps date picker reset to blank
PowerApps date picker reset to blank

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.

Power Apps date picker reset default selected date
Power Apps date picker resets the default selected date
  • 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.

PowerApps date picker reset default selected date
PowerApps date picker reset the default 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.

Power Apps date picker reset to default selected date
Power Apps date picker reset to the default selected date

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.
Power Apps datepicker reset default selected date
Power Apps date picker reset the default selected date
  • 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)
Reset PowerApps date picker to default selected date
Reset PowerApps date picker to the default selected date
  • 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.

How to reset a Power Apps date picker to default selected date
How to reset a Power Apps date picker to the default selected date

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.

Reset a Power Apps date picker to default selected date
Reset a Power Apps date picker to the default selected date

This is how to reset a Power Apps date picker to the default selected date.

See also  How to Check If a Date is Blank in Power Automate?

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()
reset a Power Apps date picker to Now
Reset a Power Apps date picker to 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.

reset a PowerApps date picker to Now
Reset a PowerApps date picker to Now

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.

How to reset a Power Apps date picker to Now
How to reset a Power Apps date picker to Now

This is how to reset a Power Apps date picker to Now.

Furthermore, you may like some more Power Apps Tutorials:

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
  • As per the below expression:
    DefaultDate = If(VarResetDate, Blank(), Parent.Default)
    the Blank() argument is taking Today’s date. But if I want to keep the date blank instead of today’s date, can you please suggest what should we do about that?

  • >