cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenDonahue
Continued Contributor
Continued Contributor

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 III
Super User III

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

BenDonahue
Continued Contributor
Continued Contributor

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 III
Super User III

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

BenDonahue
Continued Contributor
Continued Contributor

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

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (45,870)