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


Accepted Solutions
Community Support Team Rank
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.

All Replies
Community Support Team Rank
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.