cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Lon
Level: Powered On

Problems with patching gallery-items in collection

Hi guys,

i have a little problem with my SharePoint-Formula-App.

When i try to patch every gallery row which complied a condition, it patched every time the first row with the data from the last one.

 

Here my DisplayForm, the Code-Section from the Button "Schaltfläche" and how its look after OnSelect.
In  the last picture you can see the collection. For my understanding only the second row should be changed. Not the first.

 

Maybe someone can help me. 

Thanks

Leon


2.JPG


Code.JPG3.JPG
4.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Problems with patching gallery-items in collection

Hi @Lon,

I think the ForAll() part of the formula is ok but I see two problems with the Patch() function, one is actual, the second is potential. First, the syntax of the Patch function should have 3 elements, the datasource being patched, the record being patched and the columns being patched between curly braces.  Your formula is missing the record being patched and there are two sets of curly braces when only one set is needed.

Patch(AbrechnungCollectionBearbeiten;
Lookup(AbrechnungCollectionBearbeiten, ID =ThisItem.ID); {ITO : Value(TextinputitemID.Text);
6eschreibung: Textinput6eschreibung_b.Text; Menge : Value (TextinputMenge_b.Text) ; Einzelbetrag : Value(TextinputEinzelb_b.Text) ; Title : DataCardVaLueTiteL_b.Text})

The potential problem is the Bearbeiter column.  This is a Person column and in SharePoint, it is an embedded table inside of a single column.  IMHO, it appears to be a potential  problem because I don't see it as one of the columns in the third element of your Patch function.  As long as it isn't a required column, the patch should work ok.  Moreover, If you try to include it in the patch you will have a great deal of difficulty because the syntax for updating an embedded table type column (Person, Choice or Lookup) is quite complex.  

2 REPLIES 2
Super User
Super User

Re: Problems with patching gallery-items in collection

Hi @Lon,

I think the ForAll() part of the formula is ok but I see two problems with the Patch() function, one is actual, the second is potential. First, the syntax of the Patch function should have 3 elements, the datasource being patched, the record being patched and the columns being patched between curly braces.  Your formula is missing the record being patched and there are two sets of curly braces when only one set is needed.

Patch(AbrechnungCollectionBearbeiten;
Lookup(AbrechnungCollectionBearbeiten, ID =ThisItem.ID); {ITO : Value(TextinputitemID.Text);
6eschreibung: Textinput6eschreibung_b.Text; Menge : Value (TextinputMenge_b.Text) ; Einzelbetrag : Value(TextinputEinzelb_b.Text) ; Title : DataCardVaLueTiteL_b.Text})

The potential problem is the Bearbeiter column.  This is a Person column and in SharePoint, it is an embedded table inside of a single column.  IMHO, it appears to be a potential  problem because I don't see it as one of the columns in the third element of your Patch function.  As long as it isn't a required column, the patch should work ok.  Moreover, If you try to include it in the patch you will have a great deal of difficulty because the syntax for updating an embedded table type column (Person, Choice or Lookup) is quite complex.  

Lon
Level: Powered On

Re: Problems with patching gallery-items in collection

Hi @Drrickryp ,

the part with "Change-Record" in the Patch-function was the wrong.

 

Lookup(AbrechnungCollectionBearbeiten, ID=ThisItem.ID);

Worked for me.

 

I intentionally left the "Edit" field out of my example because I don't have any problems with it. At least not anymore. I totally agree with you that the complex data types are more difficult to handle. 

But i dont understand what you mean with in my formula is missing ther record being patched?!

For the solution thank you very much!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 65 members 4,697 guests
Please welcome our newest community members: