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

Updating multiple list items in powerapps

HI All, 

 

Wondering if anyone can help with following, i have a list which has a number of items in, i also have a choice field called Review with the following choices:

In Progress

Completed

Archive

 

how do i set all Completed items to Archive? i was playing around with the following:

ForAll(Filter('Quarterly Reviews', Review.Value = "Completed"), Patch('Quarterly Reviews', LookUp('Quarterly Reviews', ID = 'Quarterly Reviews'.ID), {Title:"1211111111"}))

 

i know i'm updating the title but if i could only identify items to update then i can easly change the column. 

 

Thanks in Advance

 

1 ACCEPTED SOLUTION

Accepted Solutions
wyotim
Resident Rockstar
Resident Rockstar

Hey @Ardian, I think the issue may be that you are trying to loop through the same data source you are writing to, and PowerApps doesn't like that so much. Maybe try something like this:

 

// Collect the items to loop through
ClearCollect( colFilteredQuarterlyReviews, Filter('Quarterly Reviews', Review.Value = "Completed") );
// Perform the loop ForAll( colFilteredQuarterlyReviews, Patch( 'Quarterly Reviews', LookUp( 'Quarterly Reviews',
ID = colFilteredQuarterlyReviews[@ID] ), { Title:"1211111111" } ) )

Once you get the loop right, the rest is just setting the data you want to patch given the condition set in the previous collection. Let me know if I didn't get this right; I just did this off the cuff and may have messed up the syntax somewhere.  

View solution in original post

4 REPLIES 4
wyotim
Resident Rockstar
Resident Rockstar

Hey @Ardian, I think the issue may be that you are trying to loop through the same data source you are writing to, and PowerApps doesn't like that so much. Maybe try something like this:

 

// Collect the items to loop through
ClearCollect( colFilteredQuarterlyReviews, Filter('Quarterly Reviews', Review.Value = "Completed") );
// Perform the loop ForAll( colFilteredQuarterlyReviews, Patch( 'Quarterly Reviews', LookUp( 'Quarterly Reviews',
ID = colFilteredQuarterlyReviews[@ID] ), { Title:"1211111111" } ) )

Once you get the loop right, the rest is just setting the data you want to patch given the condition set in the previous collection. Let me know if I didn't get this right; I just did this off the cuff and may have messed up the syntax somewhere.  

Ardian
Frequent Visitor

Hi @wyotim That worked perfectly, i had the following, which was also not working:

ClearCollect(ReviewsToPatch, Filter('Quarterly Reviews', Review.Value = "Current")); 
ForAll(ReviewsToPatch,Patch('Quarterly Reviews', LookUp('Quarterly Reviews', ID = ReviewsToPatch.ID), {Title:"1211111111"}))

I can see what you did with the collection ID which solved the issue. 

 

I changed wording but i did a test exactly as you sent it and syntax was all correct

 

Thank you for your help. 

wyotim
Resident Rockstar
Resident Rockstar

Awesome! Happy it worked for you!

Just made good use of this.  Thanks @wyotim for the solution and @Ardian for asking the question!

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,000)