cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rdorman
Frequent Visitor

Capture date picker value before change

Hi all,

 

I have Power App with a form that has two dates, a start date and an end date. These dates are being added to a collection when the value is changed. This works fine.

 

However if the user then changes the value of one of the fields, I need a way to be able to remove the previously selected dates from the collection and then add the new values.

 

I was trying to capture the old values in a variable using On Select so that I can do a comparison in On Change, but the On Select does not seem to trigger for the date picker.

 

Does anyone know of a way I can achieve this functionality?

 

E.g. if I have a date picker and I select 29/12/2021, that is added to my collection. Then I change my mind and want the date picker changed to 30/12/2021, I need 29/12/2021 removed from the collection before I add 30/12/2021

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @rdorman,

Do you want to update the date field once the DatePicker changes?

Could you please tell me more about your scenario?

 

I think you could just reference to the OnChange property of a DatePicker. Once the date changes to a new one, the OnChange property trigger an update action. 

However,  removing the previous date should be finished firstly and then a new date should be updated in seconds after you submit the form

 

Set the OnChange property of the DatePicker as below:

UpdateIf(CollectionName,ID=ThisItem.ID,{Date:Blank()})
Best Regards,
Qi

View solution in original post

1 REPLY 1
v-qiaqi-msft
Community Support
Community Support

Hi @rdorman,

Do you want to update the date field once the DatePicker changes?

Could you please tell me more about your scenario?

 

I think you could just reference to the OnChange property of a DatePicker. Once the date changes to a new one, the OnChange property trigger an update action. 

However,  removing the previous date should be finished firstly and then a new date should be updated in seconds after you submit the form

 

Set the OnChange property of the DatePicker as below:

UpdateIf(CollectionName,ID=ThisItem.ID,{Date:Blank()})
Best Regards,
Qi

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (4,326)