cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StephCORKING
Helper III
Helper III

Collection to update existing sharepoint list item

Hi,

 

I have a report that is put into a collection in PowerApps after doing some calculations.  The collection contains the SP List ID that will be updated along with a field value to be updated.  When I am trying to update the SP List, it doesn't seem to be working.

My Collection is called colGTSSpent and the SPList is called Footprint.

If(AppliedMonth = "08",

ForAll(colGTSSpent,

Patch(Footprint,LookUp(Footprint,ID=Value(ID)),{GTSAUG: GTSAUG})

)

)

 

If I patch the record from the gallery it works OK but it takes forever as there are around 1000 records.

 

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @StephCORKING ,

No the {ID:aPatch.ID} is the LookUp, but stated more directly.

 

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.

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @StephCORKING ,

A bit of ambiguity to be fixed - I assume ID is numeric in the collection

If(
   AppliedMonth = "08",
   ForAll(
      colGTSSpent As aPatch,
      Patch(
         Footprint,
         {ID:aPatch.ID),
         {GTSAUG: aPatch.GTSAUG}
      )
   )
)

 

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.

Hi @WarrenBelz 

Yes, ID is a numeric value in the collection and it's the ID field from the SPList, and I renamed the collection items to begin with c.  So it would would cID and cGTSAUG.

I'm a bit confused in your example.  aPatch is a variable that I need to set?

 

Also, don't I need to get the matching record from the Footprint list by using a lookup?

Steph

@StephCORKING ,

No, it is a disambiguation tool - you cannot have field names the same in the source and target when patching.

Got it, thanks.  I've changed the names in the collection.

Do I not need to include a lookup to the Footprint SP List to match the record to update?  is including it in the patch as in your example, enough?

         {ID:aPatch.ID),
         {GTSAUG: aPatch.GTSAUG}

Hi @StephCORKING ,

No the {ID:aPatch.ID} is the LookUp, but stated more directly.

 

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.

Hi @WarrenBelz 

Thanks a lot for your help on this.   It's working fine now (although it seems to run quite slowly)

 

Steph

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,303)