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 / ForAll and UpdateIf
Power Apps
Answered

ForAll and UpdateIf

(0) ShareShare
ReportReport
Posted on by 565

Hi,

 

I have 2 collections with similar data:

 

Collection colItemsHardware            Collection colMyItems

 

Item 1                                                Item 1

Item 2                                                Item 2

Item 5                                                Item 8

Item 8

 

I want to update some column ( IsChoosen ) at the collection colItemsHardware only if this item exists in collection colMyItems.

So I put a button with this formula:

 

ForAll(colMyItems,

UpdateIf(colItemsHardware, colItemsHardware.Name = ThisRecord.Name ,{IsChoosen: true}))

 

But it does not work.

Thanks for any help!

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,463 Most Valuable Professional on at

    Hi @EmilioRoqueta69 ,

    Try this

    UpdateIf(
     colItemsHardware,
     Name in colMyItems.Name,
     {IsChosen: true}
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • EmilioRoqueta69 Profile Picture
    565 on at

    Hi Warren,

     

    Thank you for the help.

    I did try these 3 types of formulas and nothing is working:

     

    ForAll(colMyItems,
    UpdateIf(
    colItemsHardware,
    Name in colMyItems.Name,
    {IsChosen: true}
    ))


    ForAll(colMyItems,
    UpdateIf(
    colItemsHardware,
    ThisRecord.Name in colMyItems.Name,
    {IsChosen: true}
    ))


    UpdateIf(
    colItemsHardware,
    ThisRecord.Name in colMyItems.Name,
    {IsChosen: true}
    )

     

    I am not so familiar with UpdateIf.

    Thanks for any help!

  • Verified answer
    WarrenBelz Profile Picture
    155,463 Most Valuable Professional on at

    @EmilioRoqueta69 ,

    None of them are what I posted. Assuming Name is the column in both collections, it should work. I just ran this manually

    ClearCollect(
     colItemsHardware,
     Table(
     {
     Name: "Item1",
     IsChosen: false
     },
     {
     Name: "Item2",
     IsChosen: false
     },
     {
     Name: "Item5",
     IsChosen: false
     },
     {
     Name: "Item8",
     IsChosen: false
     }
     )
    );
    ClearCollect(
     colMyItems,
     Table(
     {Name: "Item1"},
     {Name: "Item2"},
     {Name: "Item8"}
     )
    );
    UpdateIf(
     colItemsHardware,
     Name in colMyItems.Name,
     {IsChosen: true}
    )

    and got this result

    WarrenBelz_0-1689685741808.png

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • EmilioRoqueta69 Profile Picture
    565 on at

    Yes, because I get an error I write the same code.

    It seems like I have an issue with the "Name" columns, because I am using Dataverse as source data.

    Your code works fine at your example. Thank you so much!

     

    error.png

     

     

  • Muzammil_069506 Profile Picture
    292 Moderator on at

    This is update if will it also handle if new records are there in collection will it patch as new line and update the existing ? @WarrenBelz  please reply

  • WarrenBelz Profile Picture
    155,463 Most Valuable Professional on at

    @Muzammil_069506 ,

    Please post a new thread with more details on what you are trying to do and also your current code (in Text)

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 610

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard