cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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
Microsoft
Microsoft

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

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,209)