cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gclifford
Helper I
Helper I

Using AddColumn and then Form data will not submit

Hello,

 

New to powerapps and would appreciate some pointers.

 

I have an SQL table (Responses) which I am showing in a gallery list.  I am using the Addcolumns function to bring additional columns in from another SQL table called Questions.  Basic structure

 

Responses Table

ResponseID

QuestionID

Response

ResponseComment

 

Question Table

QuestionID

Question

QuestionType

 

so in my GalleryList I show the responses but I am bringing in Question,QuestionType from the Question Table where QuestionID=QuestionID.  This is being done in the Items box on the GalleryList.  I then pass Gallery.Selected into a displayitem variable and go to a new Screen when clicked.

 

In the new screen I have a form which I have tried using the same code above in the datasource and also tried using the displayitem variable.  In both cases I can show the data fields in the form but I am not able to use the SubmitForm to update any data to the SQL tables.  I get an error "The data source supplied to the function is invalid"

 

Can someone please point me in the right direction here?

 

Regards

 

 

 

 

 

6 REPLIES 6
v-siky-msft
Community Support
Community Support

Hi @gclifford ,

 

When you said 'I have a form which I have tried using the same code above in the datasource', do you mean you applied the AddColumns() formula in it?

If so, I am afraid the Form won't work as expected. The Data source of Form must be the real Data Source, but what does the AddColumns() function return is actually something like Collection, so the SubmitForm function doesn't work on this case.

 

The workaround is to set Data Source of Form to Responses directly and modify the Items property to LookUp(Responses, ResponseID=displayitem.ResponseID)

 

Hope this helps.

Sik

Sik,

 

Thank you for the quick response.  Can you provide additional details on what you mean by

 

"Data Source of Form to Responses directly"

 

Thank you

 

G

Hi @gclifford ,

 

What I mean is to select the Data source property of Form to Responses

Snipaste_2020-06-23_16-14-14.png

Sik

Still not sure I follow - I don't have a Responses option there

Hi @gclifford 

The datasource of a form must be an actual table, the Item property of the form must reference the same table.  Most of the time Gallery1.Selected is sufficient because the datasources of both the form and the gallery are identical.  However, if you reshape the table in the gallery by using AddColumns() or other data shaping formulas, the datasources of the gallery and form are no longer identical.  In that case, you must change the Item property of the form to Lookup(datasource,ID=Gallery1.Selected.ID) so that the correct record is chosen.  

Hi @gclifford ,

 

You said you have a SQL table(Responses) which I am showing in a gallery list, what I want is select the Responses as the Data source of Form.

Sik

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,078)