cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
zaphod88
Responsive Resident
Responsive Resident

ForAll(Patch)) is working for Collection, but not for Sharepoint Online List

Hello together,

 

I am experiencing a weird problem. I am creating an app to manage the inventory of my company. There are two kinds of it: furniture etc. that are bound to certain rooms and devices that are bound to certain persons/coworkers. 

The concerning department should be able to edit those inventory lists. To make it more effective, I am currently thinking about giving a possibility to "batch edit" those lists. For the devices list, I created a gallery for single edits before, added a bool column "Batch" to its collection, made the checkbox visible in the gallery items and set its properties like that. The variable in OnCheck is opening the batch editing form:

OnCheck

 

Patch(GalleryCollectionDevices; LookUp(GalleryCollectionDevices; ThisItem.ID = ID); {Batch: true});;
ClearCollect(BatchCollectionDevices; Filter(GalleryCollectionDevices; Batch = true));;
Set(_edvbearbeitenbatch; true)

 

 

OnUnCheck

 

Patch(GalleryCollectionDevices; LookUp(GalleryCollectionDevices; ThisItem.ID = ID); {Batch: false});;
ClearCollect(BatchCollectionDevices; Filter(GalleryCollectionDevices; Batch = true))

 


Default

 

ThisItem.Batch

 

 

The OnSelect property of the save button of this form is:

 

ForAll(BatchCollectionDevices; Patch(SharepointDevicesList; LookUp(SharepointDevicesList; ID = BatchCollectionDevices[@ID]);  { Fields: Values }));;
Refresh(SharepointDevicesList);;
ClearCollect(GalleryCollectionDevices; AddColumns(SharepointDevicesList;"Batch"; false))

 

 

Everything is working fine here, the SOL List is updated and the gallery is updated with the new values afterwards. The "Batch" field from GalleryCollectionDevices is - of course - not patched to SharepointDevicesList as it doesn't exist there.
But now I am trying to do the same for the room-bound inventory list. Of course, I am using other collections here (OnSelect of save button):

 

ForAll(BatchCollectionRoom; Patch(SharepointRoomList; LookUp(SharepointRoomList; ID = BatchCollectionRoom[@ID]); { Fields: Values }))

 


But for SharepointRoomList, it's always giving me the error:

 

Invalid argument type (Text). Table value expected.

 

 

I checked the list name for several times, but it's correct, tried to delete and added it to Powerapps again, but it's still showing. The weird thing is: If I create a collection from SharepointRoomList without any column changes and try to patch this collection instead of SharepointRoomList, it's also working fine. But then, if I try to patch the record from this collection back to Sharepoint, it's giving me the above error again, so that's not really helpful.
Is there any limitation of using ForAll and Patch together twice on the same screen? Anybody got an idea what might be the issue here?
BTW, I'm german so don't wonder about the the changed syntax. Thanks in advance.

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @zaphod88 ,

Try this on the Patch

ForAll(
   BatchCollectionRoom As aRoom; 
   Patch(
      SharepointRoomList;
      {ID:aRoom.ID); 
      {Fields: Values }
   )
)

 

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 @zaphod88 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

zaphod88
Responsive Resident
Responsive Resident

Hello @WarrenBelz , 

 

sorry for not answering for such a long time. Unfortunately, your advice did not work for me. But I think, I found the problem: SharepointRoomList is larger than 2000 items. I guess that may cause the problems. I am able to patch it item after item, but not in a ForAll. I am now using Power Automate instead, creating a concatenated collection and splitting it in Power Automate to update the items. That's working out fine as it's sufficient to hand over the ID and a new value to Power Automate.


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.

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 (2,640)