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 / Update a collection
Power Apps
Unanswered

Update a collection

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello Friends,

 

I have a collection with name, type and number, I need a way to check if the record with the same number exists in my collection, update it, if not add it to the collection.

 

 
 
 

I did a test but nothing working. 

Any idea? 

 

Thanks in advance. 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at
    @Anonymous
    Try this:

    If(
    !IsBlank(LookUp(your_collection_name, Number=1)),
    Collect(your_collection_name, {Name=“Name”, Type=“Type” And Number=1})
    )

    —-
    Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
  • WarrenBelz Profile Picture
    154,930 Most Valuable Professional on at

    Hi @Anonymous ,

    The below is a possible structure you could use - you will need to adapt the names.

    If(
     CountRows(
     MyListName,
     NumberYouHave
     )>0,
     UpdateIf(
     MyListName,
     MyNumberField = NumberYouHave,
     {
     Field1:NewValue1
     Field2:NewValue2
     }
     ),
     Patch(
     MyListName,
     Defaults(MyListName),
     {
     MyNumberField:NumberYouHave
     Field1:NewValue1
     Field2:NewValue2
     }
     )
    )

     

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I am new at this, so I did not get it very clear. 

    If(
     CountRows(
     MyCollection,
     Name of the collection column
     )>0,
     UpdateIf(
     Collection,
     Column collection= Number text box,
     {
     Field1:NewValue1
     Field2:NewValue2
     }
     ),
     Patch(
     myCollection,
     Defaults(myCollection),
     {
     MyNumberField:NumberYouHave
     Field1:NewValue1
     Field2:NewValue2
     }
     )
    )

    Something like that? 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for your answer, why I should use number 1? 

  • mdevaney Profile Picture
    29,991 Moderator on at
    @Anonymous
    You should not use number 1: it’s just a placeholder. Instead you should put the number you want to check for within the collection.

    —-
    Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
  • WarrenBelz Profile Picture
    154,930 Most Valuable Professional on at

    Hi @Anonymous ,

    You need to understand the Patch and UpdateIf syntax to apply this to your needs.

    Both myself and @mdevaney can help you here - once you apply the structure to your fields, table and control names, please tag one of us and we will fix whatever you do not get correct.

     

     

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard