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

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Update Duplicate Items...
Power Automate
Answered

Update Duplicate Items and Patch the rest

(0) ShareShare
ReportReport
Posted on by 18

I have an order database that I am trying to manage duplicate entries. I m trying to create a process that will update duplicates and patch the rest of the items in a cartlist. He is the code I have so far. There are no errors but the else condition is working just not the first condition of when a duplicate is found. The end result is nothing.

 

 

 

ForAll(
 cartlist, //cartlist is my collection
 If(
 LookUp(
 lineItems.AllItems, //lineitems is a gallery
 product_id in cartlist.ProductID,
 true
 ),
 UpdateIf(
 '[dbo].[ORDER_ITEMS]', //SQL table
 product_id exactin cartlist.ProductID,
 {quantity: quantity}
 ),
 Patch(
 '[dbo].[ORDER_ITEMS]',
 Defaults('[dbo].[ORDER_ITEMS]'),
 {
 order_id: OrderID,
 product_id: ProductID,
 quantity: QTY,
 item_filled: 0
 }
 )
 )
)

 

 

Categories:
I have the same question (0)
  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @EOCF-Pwrapp 

     

    This is because the condition provided as part of the expression is not correct. Can you try to update the expression to:

    ForAll(
    cartlist, //cartlist is my collection
    If(
    CountRows(Filter(
    lineItems.AllItems,
    product_id in cartlist.ProductID)
    ) <> 0,
    UpdateIf(
    '[dbo].[ORDER_ITEMS]',
    product_id exactin cartlist.ProductID,
    {quantity: quantity}
    ),
    Patch(
    '[dbo].[ORDER_ITEMS]',
    Defaults('[dbo].[ORDER_ITEMS]'),
    {
    order_id: OrderID,
    product_id: ProductID,
    quantity: QTY,
    item_filled: 0
    }
    )
    )
    )

     

    Hope this Helps!

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • EOCF-Pwrapp Profile Picture
    18 on at

    I was able to find a different work around for this by using a stored procedure. Thank you.

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @EOCF-Pwrapp 

     

    Glad that you were able to resolve. If this query has been solved, please mark the response that helped you as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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 Automate

#1
trice602 Profile Picture

trice602 239 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 177 Super User 2026 Season 1

#3
Kalathiya Profile Picture

Kalathiya 97 Super User 2026 Season 1

Last 30 days Overall leaderboard