cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bobby_Wallace
Frequent Visitor

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

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

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

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