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
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?
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.
Thank you for the quick response. Can you provide additional details on what you mean by
"Data Source of Form to Responses directly"
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.
Check out new user group experience and if you are a leader please create your group
Did you know that you can visit the Power Query Forum in Power BI and now Power Apps
Participate in the Power Virtual Agents Community Challenge
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.
Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.