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 change value by...
Power Apps
Answered

How to change value by 1 for multiple rows - SharePoint List

(0) ShareShare
ReportReport
Posted on by 30

I have an app where users can list multiple peripherals and it will update the quantity of each in a SharePoint List. Power Apps doesn't like how I'm identifying the field and says, "Invalid argument type. Expecting one of the following: Number, Text, Boolean."

 

The code is:

 

ForAll(TempPeriphList, Patch(PeriphData, LookUp(PeriphData, Title = TempPeriphList[@Asset]), {Qty:PeriphData.Qty -1, Comment:Now() & " One device deployed."}));

 

TempPeriphList is a collection. PeriphData is a SharePoint List. The part that Power Apps doesn't like is "PeriphData.Qty - 1", specifically just the ".Qty" part of it. The data is being saved as a number in SharePoint. The rest of the code works, it's updating the comment for each peripheral listed, just won't update the quantity.

 

Any help is greatly appreciated!

 

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @JustinM5 

    You are specifying an entire table when you use PeriphData.Qty it will return a table with a single column called Qty.

    Plus the results of your ForAll are not being used properly.  

     

    Please consider changing your Formula to the following:

    Patch(PeriphData,
     ForAll(TempPeriphList As _item,
     With({_record: LookUp(PeriphData, Title=_item.Asset)},
     {ID: _record.ID
     Qty: _record.Qty - 1,
     Comment: Text(Now()) & " One device deployed."
     }
     )
     )
    )

     

    I hope this is helpful for you.

  • JustinM5 Profile Picture
    30 on at

    That worked! Thank you very much!

     

    I'm going have to look at it for a while to fully understand it (I'm a little confused by the need for ID: _record.ID), but I'm happy it's working!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @JustinM5 

    The reason for the ID is that the Patch function needs it to match it to an existing record in order to update it.

    If it is not supplied, Patch will consider it a new record and thus create new ones.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard