cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tom_garvin
Level 8

Non-repeatable failure with OnSubmit to Azure SQL Database

I have a fairly simple table in Azure SQL DB, primary key is standard integer "identiy" key, and there is a Timestamp field.

 

I visit the record with a standard Display Form, then move to a standard Edit form. There are six simple text fields and one integer field. Also included is my Timestamp field, in read-only control.

 

I press my Save button which runs a simple SubmitForm behavior. Even when changing NO DATA, I receive an error message "An entry is required or has an invalid value". It is important to note that all required fields are populated, as this is a server-level constraint. And since no data has changed, I don't see where anything can be considered invalid, as we're just working with data read directly from the database a few seconds earlier. (or possibly cached earlier, but not updated by any other user or procedure)

 

When I attempt a second save, usually the update works. No changes to data have been made. Trying to solve the immediate problem, I doubled-up with "SubmitForm(Artist_Edit_Form);SubmitForm(Artist_Edit_Form)".

 

I make a very simple change and observe that the first save usually fails with the red banner, which quickly disappears when the second save succeeds, which triggers a Back() function, and I then verify the update has, in fact, been saved.

 

I have not had a similar problem with CDS or Excel, but those were simpler cases I worked via the edX training course. Therefore I suspect Azure SQL DB in particular, or any SQL Server datasource in general.

 

Looking for ideas on how to diagnose and work around, without hammering on multiple submits.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Non-repeatable failure with OnSubmit to Azure SQL Database

Hi @tom_garvin,

 

Thanks for the clarification.

 

Just tested with Azure SQL DataBase, saving for new records or Edting existing records both works.

And there is no error message popped out.

 

Things you may take a notice of:

1. Verify all the required field is entered with an effective value, specially for the Primary key and the foreign key field.

2. If possible, please capture the error messages popped out after the submit button at the top of the running app, if capture is not convenient, then consider take use of errors () function to collect the error information, which could be useful for further investigation.

For how to use Errors() function, see:

Errors function in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Community Support Team
Community Support Team

Re: Non-repeatable failure with OnSubmit to Azure SQL Database

Hi @tom_garvin,

 

Thanks for the feedback, I will make some tests for SQL Database in Azure and update the result here.

Tried with on-premise SQL table, and there is no issue occurred when trying to create new records.

Adding some reference for the Limtis when working with SQL Server:

SQL Server

 

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tom_garvin
Level 8

Re: Non-repeatable failure with OnSubmit to Azure SQL Database

BTW, I have not yet attempted to add new records, my trouble report is specific to saving edits to an existing record.

 

In terms of "non-repeatable", with more test, I can say that the FIRST save attempt usually fails, then the second click works as intended. Therefore, I don't think the error message is accurate in terms of data errors.

 

I had referenced SQL Timestamp fields in the table, and posted that I thought adding the Timestamp field to the Edit form appeared to help, but upon further thought, realize this makes no sense whatsoever. Please disregard.

Community Support Team
Community Support Team

Re: Non-repeatable failure with OnSubmit to Azure SQL Database

Hi @tom_garvin,

 

Thanks for the clarification.

 

Just tested with Azure SQL DataBase, saving for new records or Edting existing records both works.

And there is no error message popped out.

 

Things you may take a notice of:

1. Verify all the required field is entered with an effective value, specially for the Primary key and the foreign key field.

2. If possible, please capture the error messages popped out after the submit button at the top of the running app, if capture is not convenient, then consider take use of errors () function to collect the error information, which could be useful for further investigation.

For how to use Errors() function, see:

Errors function in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tom_garvin
Level 8

Re: Non-repeatable failure with OnSubmit to Azure SQL Database

It's pretty obvious to me that there would never be a super-obvious bug related to SQL Server data sources. 

 

I ran a few more tests, based on your reply, and then by process of elimination, think I have found the issue.

 

I included my primary key (32 bit integer, autonumber Identity) ON the edit form for display purposes.

 

It was appropriately set as a read-only field, so I did not worry about it until now.

 

I deleted it from the Edit control and the problem went away. It's a mystery to me why the Submit failed the first time, but not subsequent times, but it's not anything I need to resolve.

 

Thanks for the diagnostic inspiration!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 70 members 4,433 guests
Please welcome our newest community members: