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:
Collection:
Patch Statement:
SharePoint list with newly created items:
I am not knowledgable enough to figure this out. It doesn't make any sense.
Solved! Go to Solution.
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
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
Thanks. I did indicate in the post that I am only creating new items. It's not designed to update any items.
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
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.
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],.....
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.
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
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.
check data in the gallery HolidayCollection2
you can go to View and see data in a collection
User | Count |
---|---|
132 | |
127 | |
78 | |
74 | |
70 |
User | Count |
---|---|
208 | |
199 | |
64 | |
63 | |
52 |