cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Updating Date values in a collection

Hi, 

I have a collection which has a number of date fields.

Can anyone advise what command I can run to change the date values in that collection?

For example, if I want to change all dates that match 01/01/2020 (UK format) to be 31/12/2020.

 

Presumably it's an UpdateIf statement required, but PowerApps is not liking my syntax so far.

 

Many thanks

Paul

1 ACCEPTED SOLUTION

Accepted Solutions

@PJBruen 

 

Try using following:

UpdateIf(colStressTestTimeline, KeyMilestone_StartDate=Date(2020,09,24), {Title: "2019/2019 - BES", KeyMilestone_StartDate: Date(1900,1,1)});

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

View solution in original post

10 REPLIES 10
Dual Super User
Dual Super User

@PJBruen 

 

Created a sample collection as below:

ClearCollect(colDates, [{Title: "Sam", Date: "11/12/2020"}, {Title: "David", Date: "11/10/2020"}, {Title: "John", Date: "11/12/2020"}, {Title: "Jason", Date: "11/12/2020"}])

 

Placed a button on the screen and OnSelect wrote following formula:

UpdateIf(colDates,Value.Date="11/12/2020",{Value: {Title: Value.Title, Date: "11/09/2020"}})

 

On clicking the button, it uses UpdateIf function to check the date value "11/12/2020" in the collection and replaces with "11/09/2020" for each item in the collection.

 

I hope this will be useful for you.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.
Helper III
Helper III

Hi, @rsaikrishna - thanks for your reply.

I'm still having a little trouble getting this right. Here's what I have:

 

colStressTestTimeline

PJBruen_0-1606314674801.png

 

The formula I have is: UpdateIf(colStressTestTimeline, KeyMilestone_StartDate="24/09/2020", {Title: "2019/2019 - BES", KeyMilestone_StartDate: "01/01/1900"});

 

I know this slightly differs to yours, but the syntax of value.KeyMilestone_StartDate didn't appear valid.

 

Any ideas?

Thanks. Paul

 

Helper III
Helper III

@rsaikrishna 

Sorry - not sure I can reply to the meeting request..

@PJBruen 

 

In your collection, do you see Records or direct values as shown in your screen shot?

 

If you see direct values, then you do not need to use value.KeyMilestone_StartDate. 

 

When you use the following formula:

UpdateIf(colStressTestTimeline, KeyMilestone_StartDate="24/09/2020", {Title: "2019/2019 - BES", KeyMilestone_StartDate: "01/01/1900"});

 

Do you see any issues with above formula? If so, share the details of the error.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

Helper III
Helper III

Hi @rsaikrishna 

The collection is as per the screenshot, so I see records that have been populated by a ClearCollect call against a Sharepoint site.

 

regards.

Helper III
Helper III

@rsaikrishna - the error I see is:

PJBruen_0-1606316674549.png

 

@PJBruen 

 

When you use the following formula:

UpdateIf(colStressTestTimeline, KeyMilestone_StartDate="24/09/2020", {Title: "2019/2019 - BES", KeyMilestone_StartDate: "01/01/1900"});

 

Do you see any issues with above formula? If so, share the details of the error.

Helper III
Helper III

Sorry - see above...

@PJBruen 

 

Try using following:

UpdateIf(colStressTestTimeline, KeyMilestone_StartDate=Date(2020,09,24), {Title: "2019/2019 - BES", KeyMilestone_StartDate: Date(1900,1,1)});

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (3,607)