cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

PowerApps to SQL Server Form

I've created a PowerApps form to add a row to a table in a SQL Server database.  The form mode is set to "New".  Here is the UsbmitForm statement: SubmitForm(FORMTargetTable);Refresh('[dbo].[TargetTable]');ResetForm(FORMTargetTable).

 

There are seven data cards (each for a required field in the target table) with associated controls.  Five controls use dropdown lists to limit data entered.  Lists are sourced from other tables within the SQL Server database.  The structure for each data card is DataCard1.Update.Field1.TargetTable from DropownX.FieldX.SourceTable.

 

Update statements for each data card with a dropdown are: DropdownX.Selected.FieldX.  An earlier version had the update parameter set to [dbo].[TargetTable].[Field1].

 

The SubmitForm statement for the button control is: SubmitForm(FORMName);Refresh('[dbo].[TargetTable]');ResetForm(FORMName)

 

When I click the button to submit the form, I get an error message that the data card associated with the first dropdown list has no data despite having made a selection.  My guess is if this data card is fixed, the next in line will have the same issue.  I suspect dropdown selection aren't being passed through the update parameter of the data card.

 

Any suggestions for how to overcome this?  I've looked at Patch but don't think it should be needed for this app as this is a one screen app pushing data to a single table in SQL Server.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: PowerApps to SQL Server Form

Thanks for the response.  Since posting the original question, I found my mistake in first building the form.

 

On the data cards with the dropdown lists, I had removed the Data Value controls.  Removing those cards and placing new ones, I added the dropdowns and set the update parameter for the data card to: DropdownName.Selected.DropdownDataElementName.

 

This change passed the dropdown selection to the data value which is what SubmitForm picks up.  Now, once selections are made and all required fields completed, clicking the button to accept adds a new record to the SQL Server database.

 

Now if I can only recreate the app for online use with a direct query to the database.  But that's another topic.

View solution in original post

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: PowerApps to SQL Server Form

One correction to SubmitForm, instead of it saying FORMTargetTable it should say FORMForm1.

Highlighted
Microsoft
Microsoft

Re: PowerApps to SQL Server Form

Thanks for the response.  Since posting the original question, I found my mistake in first building the form.

 

On the data cards with the dropdown lists, I had removed the Data Value controls.  Removing those cards and placing new ones, I added the dropdowns and set the update parameter for the data card to: DropdownName.Selected.DropdownDataElementName.

 

This change passed the dropdown selection to the data value which is what SubmitForm picks up.  Now, once selections are made and all required fields completed, clicking the button to accept adds a new record to the SQL Server database.

 

Now if I can only recreate the app for online use with a direct query to the database.  But that's another topic.

View solution in original post

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (3,403)