I know to clear a date picker you could set the DefaultDate picker to a variable and then clear the variable on some other action and reset the date picker to clear the selected date.
My date picker is on an edit form (not a true Power Apps form) so the DefaultDate needs to be whatever the user selected.
What is the best way to clear this value?
Solved! Go to Solution.
I am not using a standard Power Apps form so I am not able to use the Parent values. I added an X icon with the following OnSelect
UpdateContext({locResetDate: true}); Reset(DatePickerControl)
and changed the DefaultDate in the date picker to
If(!locResetDate, [original date])
Hi @Cooper01 ,
Could you tell me:
I assume that :
1.You use the custom form in SharePoint list.
2.You want to clear the default date value of DatePicker in Edit Form and don’t display any date in the datepicker.
If so, firstly, fields in the EditForm pick it source from the database. So if the connected table in the database for the date is not blank, then there will be a date in datepicker in EditForm.
Therefore, you can clear the default date when you use the datepicker in edit form via setting the DefaultDate property of datepicker to:
If(EditFormName.Mode=FormMode.Edit,Blank(),Parent.Default)
Then you will find the default date value in the date picker will be the value of InputTextPlaceholder property as below:
So just clear the value of InputTextPlaceholder and you will find that you have cleared this selected date.
If I have any misunderstanding, please correct me.
Hope it helps!
Best Regards,
Arrow
Thank you for the response. This is not using SharePoint as the data source, it is Dataverse. There is no Power Apps form being used, basically I have a gallery with a list of items from a table. I click on the item and set selected to a global var and navigate to a different screen. Then the date picker default is SelectedItemGlobalVar.MyDateFieldValue
Hi @Cooper01 ,
Welcome!
As your description, I add a gallery and set an entity in Dataverse as the data source.
When i click the item an it will navigate to another screen as below:
Do you want to clear this value in my screenshot?
If i have any misunderstanding, please feel free to let me know.
Thanks,
Arrow
Yes that's correct this is what I'm looking to clear
Hi @Cooper01 ,
Thanks for your reply.
Whether you want to clear the DatePicker but keep the DefaultDate.
If so, you have to add an extra Remove button in the data card to clear the selected date. Please refer to the following steps:
1.Unlock the data card, insert a Cancel icon
2.Set Icon.OnSelect:
Set(vardate,Blank())
3.Set DatePicker.DefaultDate:
If(IsBlank(vardate),vardate,Parent.Default)
4.Set DatePicker.OnChange:
Set(vardate,1)
5.Enable the "Formula Level error management" in Advanced Setting. (Important!)
Best Regards,
Arrow
I am not using a standard Power Apps form so I am not able to use the Parent values. I added an X icon with the following OnSelect
UpdateContext({locResetDate: true}); Reset(DatePickerControl)
and changed the DefaultDate in the date picker to
If(!locResetDate, [original date])
User | Count |
---|---|
164 | |
90 | |
73 | |
64 | |
57 |
User | Count |
---|---|
213 | |
153 | |
96 | |
88 | |
66 |