web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Updating a collection ...
Power Apps
Answered

Updating a collection based on a condition

(0) ShareShare
ReportReport
Posted on by 10

I am trying to update values in a collection based on another collection. 

This my code that I am currently executing on a button press.

 

ClearCollect(
    TestList,
    {Parameter: "ABC"},
    {Parameter: "DEF"}
);
ClearCollect(
    colParamsinB,
    CustomerComponentB
);
ForAll(
    colParamsinB,
    If(
        LookUp(
            TestList,
            Parameter = ThisRecord.Parameter,
            true
        ),
            Patch(
            CustomerComponentB,
            First(
                Filter(
                    CustomerComponentB,
                    Parameter = ThisRecord.Parameter
                )
            ),
            {Required: false}
        )

       
    )
)
 
I would like the required part to be updated for each parameter that is in the test list.
They both match the test list. At the moment it is updating the first row of the collection which is not one of the parameters in the testCollection. I have tested each section in isolation
 
I am relatively new to power apps but this would be very simple logic in python which is what I am used to.
Categories:
I have the same question (0)
  • Verified answer
    Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @NthnClrksn ,

     

    If I understand what you want, 

    After your ClearCollect functions, use this code

    UpdateIf(
     CustomerComponentB,
     Parameter in TestList.Parameter,
     {
     Required: false
     }
    );

     

    Hope this helps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 85

#2
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard