cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bobby_Wallace
Level: Powered On

Mitigating Database Errors

I am trying mitigating database errors; catch them before they occur. For example, it a SubmitForm is going to fail because of a duplicate key, I would like to be able to catch it and display an error message.

 

Thanks in advance...

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Mitigating Database Errors

Hi @Bobby_Wallace,

 

We could avoid some errors before they happen by using the Validate and DataSourceInfo functions. The Validate function checks whether the value of a single column or a complete record is valid for a data source, while DataSourceInfo provides information about a data source.

 

About your scenario of checking a duplicate key, please check if the following way will work for you.

Create an app that is based on SharePoint list B.

On the EditForm screen, within the Title card, under the Title label, add another label and set its Text property with the following code:

If(IsEmpty(Filter(ListB,DataCardValue9.Text in Title))=false,"conflict","")

Then when you enter an item that already exists, error message conflict will be displayed, otherwise, it will be blank.

1.PNG

Hope it could be your reference.

 

Best regards,

Mabel

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

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Mitigating Database Errors

Hi @Bobby_Wallace,

 

We could avoid some errors before they happen by using the Validate and DataSourceInfo functions. The Validate function checks whether the value of a single column or a complete record is valid for a data source, while DataSourceInfo provides information about a data source.

 

About your scenario of checking a duplicate key, please check if the following way will work for you.

Create an app that is based on SharePoint list B.

On the EditForm screen, within the Title card, under the Title label, add another label and set its Text property with the following code:

If(IsEmpty(Filter(ListB,DataCardValue9.Text in Title))=false,"conflict","")

Then when you enter an item that already exists, error message conflict will be displayed, otherwise, it will be blank.

1.PNG

Hope it could be your reference.

 

Best regards,

Mabel

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

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,503)