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
Solved! Go to Solution.
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 Solution. Marking 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. |
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 Solution. Marking 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. |
Hi, @rsaikrishna - thanks for your reply.
I'm still having a little trouble getting this right. Here's what I have:
colStressTestTimeline
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
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 Solution. Marking 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. |
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.
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.
Sorry - see above...
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 Solution. Marking 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. |
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
214 | |
205 | |
86 | |
59 | |
38 |
User | Count |
---|---|
322 | |
260 | |
127 | |
86 | |
55 |