cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JR-BejeweledOne
Level: Powered On

Patching Gallery results in duplicate items in SharePoint list

I have an app where I am patching a gallery to a SharePoint list.   The app is only creating new items (by default) and not used to udpate anything.   It was working correctly initially but now is creating duplicate items from the last item entered into the collection rather than creating a unique item for each item in the collection.

 

Input:

 

Input.jpg

 

 

Collection:

 

Collection.jpg

 

Patch Statement:

 

Patch.jpg

 

SharePoint list with newly created items:

 

SPList.jpg

 

I am not knowledgable enough to figure this out.    It doesn't make any sense.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Patching Gallery results in duplicate items in SharePoint list

Hi @JR-BejeweledOne 

 

ForAll(HolidayCollection2,Patch('Holiday List',Defaults('Holiday List', {Holiday: HolidayCollection2[@Holiday],Country: HolidayCollection2[@Country] .....

 

Did you try the above formula?

 

I understand we are not reading but patching to SharePoint

The above formula, just reads data from your collection HolidayCollection2 - and use the data within that collection to add information to SP list

 

 

 

 

 

 

View solution in original post

11 REPLIES 11
Dual Super User
Dual Super User

Re: Patching Gallery results in duplicate items in SharePoint list

Hi @JR-BejeweledOne 

 

In Patch you are using Defaults() - which means it will only create new items

 

If you need to update items - you will need to replace Defaults with the item reference

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

JR-BejeweledOne
Level: Powered On

Re: Patching Gallery results in duplicate items in SharePoint list

Thanks.   I did indicate in the post that I am only creating new items.   It's not designed to update any items.

Dual Super User
Dual Super User

Re: Patching Gallery results in duplicate items in SharePoint list

Hi @JR-BejeweledOne 

 

ForAll(HolidayCollection2,Patch('Holiday List',Defaults('Holiday List', {Holiday: HolidayCollection2[@Holiday],Country: HolidayCollection2[@Country],  .... and so on

 

Try this

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

JR-BejeweledOne
Level: Powered On

Re: Patching Gallery results in duplicate items in SharePoint list

Not sure I follow.   

 

How do I get .......{Holiday: HolidayCollection2[@Holiday],Country.......     out of (Holiday: tiHolidayDisplay.Text,Country.....)?

 

Using  (Holiday: HolidayCollection2[@tiHolidayDisplay.text],.....    Just gives an error.

Dual Super User
Dual Super User

Re: Patching Gallery results in duplicate items in SharePoint list

Hi @JR-BejeweledOne 

 

Use  as is -  {Holiday: HolidayCollection2[@Holiday]

 

HolidayCollection2[@Holiday] - will get the Holiday column information from the HolidayCollection2 collection

 

You dont need to refer to tiHolidayDisplay.text

do not use - (Holiday: HolidayCollection2[@tiHolidayDisplay.text],.....    

JR-BejeweledOne
Level: Powered On

Re: Patching Gallery results in duplicate items in SharePoint list

I think you may be confused.    I am not 'getting' anything from the SharePoint list.   The list is a repository only.

 

This app is using information from other sources to populate the SharePoint list and that is all.   It's only function is to create new items in that list.   There is no information in the list for it to get.  

 

All of the information being used in the PowerApp is from other data sources and then compiled into an internal collection within the app (created when the PowerApp is opened) and then patched into the SharePoint list.

 

Also there is no Holiday column in the collection.  

 

 

 

Dual Super User
Dual Super User

Re: Patching Gallery results in duplicate items in SharePoint list

Hi @JR-BejeweledOne 

 

ForAll(HolidayCollection2,Patch('Holiday List',Defaults('Holiday List', {Holiday: HolidayCollection2[@Holiday],Country: HolidayCollection2[@Country] .....

 

Did you try the above formula?

 

I understand we are not reading but patching to SharePoint

The above formula, just reads data from your collection HolidayCollection2 - and use the data within that collection to add information to SP list

 

 

 

 

 

 

View solution in original post

JR-BejeweledOne
Level: Powered On

Re: Patching Gallery results in duplicate items in SharePoint list

That seems to have partially worked, although I was unable to use it for the Date picker items.  I get an error when trying to set the date picker items that way.

 

So the dates are still duplicated from the last item in the collection while the other fields are now correct and unique for each item.

Dual Super User
Dual Super User

Re: Patching Gallery results in duplicate items in SharePoint list

@JR-BejeweledOne 

 

check data in the gallery HolidayCollection2

you can go to View and see data in a collection

 

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,390)