See the image below, I'm not sure why I'm getting an error.
I have a Gallery (datasource is a SQL database called Pipeline), where I'm using an icon to Set(varPipeline, ThisItem).
I have a form, data is set to Pipeline - and item is set to varPipeline. However, when I run SubmitForm(Form1)), I get the error below. Any ideas?
Hi @Connor55 ,
Could you please show more details about the error message within your "Submit" button?
Have you defined a proper Primary Key within your SQL Table ('[dbo].[Pipeline]')?
Firstly, please make sure you have defined proper Primary Key within your SQL Table. It is known limits with SQL Server connector in PowerApps, please check the following article for more details:
If you want to use a Edit form to edit the selected item within the Gallery, I think it is not necessary to initialize a variable to store the selected item in your Gallery. Please take a try with the following workaround:
Set the Items property of the Gallery to following:
Set the DataSource property of the Edit form to following:
set the Item property of the Edit form to following:
Please take a try with above solution, check if the issue is solved.
Also please check if you have defined some Required fields in your SQL Table, if so, please make sure you have enabled them within your Edit form, and provide proper values for these Required fields.
In addition, you could also consider submit the form data back to your SQL Table using Patch function instead of SubmitForm function. Set the OnSelect property of the "Submit" button to following:
Patch( '[dbo].[Pipeline]', Gallery1.Selected, Form1.Updates )
Patch( '[dbo].[Pipeline]', LookUp('[dbo].[Pipeline]', 'Primary Key Column' = Gallery1.Selected.'Primary Key Column'), Form1.Updates )
Please consider take a try with above solution, then check if the issue is solved.
Thanks for the help! I have no idea what changed - but it's all working fine now.
Hi @Connor55 ,
Have you solved your problem?
Is the solution I provided above helpful in your scenario?
If you have solved your problem, and the solution I provided above is helpful in your scenario, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!