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 / Matching collection va...
Power Apps
Unanswered

Matching collection values to Sharepoint List ID and reduce related id row by collection value

(0) ShareShare
ReportReport
Posted on by 46

Hi all,

I have been trying to find a way to update a SharePoint list with stock from a collection on PowerApps.

For further explanation, I have created a shopping cart app that has a shopping basket collection. 

The first thing I do is patch it into an orders SP List to create an order history of all the customer details and the items ordered. 

I would like to then take all respective items put in the basket and reduce the quantity of the items on a separate stock list.

 

The collection already has an ID that matches the ID from the stock list. So theoretically it should be simple enough to match the Collection ProductID with the Sharepoint ID and then reduce the SP quantity by the collection quantity. However, I can't seem to get the types to match. I have been trying Foralls, Patch's and lookups but can't seem to get rid of 'incomparable types' and 'invalid argument' errors. 

 

Any help would be greatly appreciated!

 

Thanks

Categories:
I have the same question (0)
  • VincentGiovanni Profile Picture
    on at

    Did you find a solution to this? I´m struggling aswell with this...

  • EitanKGCS Profile Picture
    46 on at

    Hi Vincent,

     

    Actually, I did! After staring at my formulas for hours on end I eventually came up with a solution:

     

    Adding an 'as' function really helps to identify the value you are trying to deduct. 

     

    The formula matches the unique identifier between your collection and your SP list and then deducts by the value in your collection for each record in your collection. 

     

    ForAll(
     colShoppingCart As Basket,
     UpdateIf(
     'Merchandise Stock List_1',
     ID = Basket.ProductID,
     {
     Quantity: Value(
     LookUp(
     'Merchandise Stock List_1',
     ID = Basket.ProductID
     ).Quantity
     ) - Basket.QTY
     }
     )
    );

     

    Good luck and I 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 426

#2
WarrenBelz Profile Picture

WarrenBelz 381 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 315 Super User 2026 Season 1

Last 30 days Overall leaderboard