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 / How to stop Patch over...
Power Apps
Unanswered

How to stop Patch overwriting LookUp Column Values

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hey everyone,

 

So I've got 2 lists here,

SharePoint Picture Library: Auction Item Photos 
SharePoint List: Auction Items

 

In Auction Item Photos, I have a lookup column called Auction Item LookUp which looks up to the Auction Items list and grabs an auction item, essentially making it so that one photo can be re-used by multiple auction items.

 

VIP567_0-1631943684723.png

 

I'm trying to make it so that after the Admin creates an Auction Item, they can go in and select all the pictures they want associated with the created item. 

VIP567_3-1631943993263.png

VIP567_1-1631943835793.png


Once you click "Done" I want to loop through all the selected photos and add the selected Auction Item to the Auction Item LookUp column.

 

Currently with my code if I click "Done", it adds the items to the correct photos no problem.

VIP567_4-1631944232654.png

 

But once I select a different Item to add photos to, its replacing the previous values

VIP567_5-1631944290890.png

 

 

ClearCollect(
 AddImages,
 AuctionItemImageGallery_1.AllItems
);
RemoveIf(
 AddImages,
 Checkbox3.Value = false
);
ForAll(
 AddImages,
 Patch(
 'Auction Item Photos',
 {ID: ThisRecord.ID},
 {
 'Auction Item LookUp': Table(
 {Id: Gallery1.Selected.ID},
 {Value: Gallery1.Selected.Title}
 )
 
 }
 )
)

I believe it may be something to do with the ID I'm using but I've gone too deep, need another set of eyes 🙂 
Hopefully makes sense, will clarify if needed.

 

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

    Hi @Anonymous ,

    It is everything to do with the ID and one of the many reasons you need to consider why you actually need to use Lookup columns (this would be very easy with a Text column) - but that is another discussion . . .

    The ID (actually Id ) is the ID of the item looked up in the other list and you may not have this in the Gallery. Another issue is that the value you post must match the value of this field in the other list. Assuming that they do match, you would need to do something like this

    With(
     {
     wImages:
     Filter(
     AuctionItemImageGallery_1.AllItems,
     Checkbox3.Value
     )
     },
     ForAll(
     wImages As aPatch,
     Patch(
     'Auction Item Photos',
     {ID: wImages.ID},
     {
     'Auction Item LookUp': 
     {
     Value: aPatch.Title,
     Id:
     LookUp(
     'Action Items',
     YourFieldLookedUpName = aPatch.Title
     ).ID
     }
     }
     )
     )
    )

     

    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.

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 839

#2
Valantis Profile Picture

Valantis 533

#3
Haque Profile Picture

Haque 412

Last 30 days Overall leaderboard