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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,837)