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

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

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

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,326)