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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error when updating it...
Power Apps
Answered

Error when updating items on SP list from a collection

(1) ShareShare
ReportReport
Posted on by 20
I am encountering an issue with a collection on my app. My goal is to check if the data in the collection exists on my SharePoint list or not. If it exists then update the item, if not then just create a new item. I get an error message on the lookup of my code. You will see a error line on the LookUp.
 
 
Error Message:
Error when trying to retrieve data from the network, fetching items failed. Possibly invalid string or filter query. 
 
 
 
If(
  !IsBlank(myCollection),
ForAll(
       myCollection,
Patch(SharePointList, LookUp(SharePointList, ID = ThisRecord.ID),
{
Project: colProjectName,
Quantity:colQuantity
}
)));
 
 
 
 
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,541 Most Valuable Professional on at
    Hi
    Firstly, why bother with the collection - try this
    If(
       CountRows(Gallery2.AllItems) > 0,
       Patch(
          CapexExpenseDetails, 
          ForAll(
             Gallery2.AllItems As _Data,
             {
                ID: _Data.ID,
                ProjectDescription: _Data.DescriptionTextbox.Value,
                Quantity: Value(_Data.QuantityTextbox.Value),
                UnitCost: Value(_Data.UnitCostTextbox.Value),
                ExtendedCost: Value(_Data.ExtendedCostTextbox.Value)
             }
          )
       )
    )
     
    Also, ForAll is not designed to be a loop, although it can act that way if it contains an action inside it. ForAll creates a Table, which can be Patched in one action to the data source and will run much faster than individual Patches for each record. If it contains the ID of each record, it will update the specific records, if not it will create new records.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 428

#2
WarrenBelz Profile Picture

WarrenBelz 374 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 333 Super User 2025 Season 2

Last 30 days Overall leaderboard