cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenDonahue
Skilled Sharer
Skilled Sharer

A Patch() in a gallery updating a collection ThisItem looking for "Author"

I have a SharePoint list. As the data source for a gallery, I am referencing this list, using ShowColumns() and an AddColumns(), like so to create and populate a collection, colQuestions:

 

 

ClearCollect(colQuestions, AddColumns(ShowColumns(colQuestionsList,"QNum","Q","QOrder","QGroup","Title"), "Answer","-", "Notes", ""));

 

 

This perfectly takes the SP list, works with only the 5 columns I listed , and adds the last two columns, Answers and Notes, along with their default answers.

From within the gallery, for the OnChange property for a dropdown, I am trying to use this code:

 

 

Patch(colQuestions, ThisItem, {Answer: QResYN.Selected.Value});

 

 

 

This gets em the following error for ThisItem:

BenDonahue_0-1618854639061.png

Where have I gone astray where I told PowerApps to look for the column, "Author?"
For reference sake, here is colQuestions at this point:

BenDonahue_1-1618854850702.png
Thank you for your help.

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User
Super User

@BenDonahue 

Your problem comes from the fact that ThisItem is a record that no longer has the same schema as your collection.  Therefore, the ThisItem record has columns in it that it cannot figure out based on the collection.

So, you will need instead to determine the record in your collection that you want to match, or change your collection to have the same schema you want and then not have to worry about adding or showing columns in your Items property.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

BenDonahue
Skilled Sharer
Skilled Sharer

It does help, both in helping fix this use case, and in giving me a deeper appreciation for the underlying issue that was causing me my problems.

 

While composing my response, with a follow up question, I exposed the cause of this transposed schema referencing; I thought I was using colQuestions as my data source in my gallery, but was using a full copy of the SharePoint list, which contained "Author." Changing the data source to colQuestions fixed the issue by, and this is where I really appreciate your helpful deep explanation, bringing into alignment the schema that was being referenced with the schema of was was being updated by making them the same collection, and therefore the same schema. 

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@BenDonahue 

Your problem comes from the fact that ThisItem is a record that no longer has the same schema as your collection.  Therefore, the ThisItem record has columns in it that it cannot figure out based on the collection.

So, you will need instead to determine the record in your collection that you want to match, or change your collection to have the same schema you want and then not have to worry about adding or showing columns in your Items property.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
BenDonahue
Skilled Sharer
Skilled Sharer

It does help, both in helping fix this use case, and in giving me a deeper appreciation for the underlying issue that was causing me my problems.

 

While composing my response, with a follow up question, I exposed the cause of this transposed schema referencing; I thought I was using colQuestions as my data source in my gallery, but was using a full copy of the SharePoint list, which contained "Author." Changing the data source to colQuestions fixed the issue by, and this is where I really appreciate your helpful deep explanation, bringing into alignment the schema that was being referenced with the schema of was was being updated by making them the same collection, and therefore the same schema. 

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,538)