Attribute Rule error message from GeodatabaseAttributeRuleException

84
1
08-20-2018 01:54 PM
Highlighted
New Contributor II

Currently I am getting the generic error message "Violated attribute constraint rule" when adding a record to a Standalone Table with attribute rules through an Inspector.

Is it possible to get the specific error message of the Attribute Rule from the GeodatabaseAttributeRuleException?

Attribute Rule Exception Message

Tags (1)
Reply
0 Kudos
1 Reply
Highlighted
New Contributor II

Answering my own question...

Rather than create the row on the table directly, an EditOperation was used in which an Inspector was loaded with the modified values. When the EditOperation.Execute() call fails due to an Attribute Rule error, the EditOperation.ErrorMessage property is populated with the Attribute Rule error message.

CurrentEditOperation.Name = "Road Name Create";
CurrentEditOperation.Create(AttributeInspector.MapMember, AttributeInspector);

bool result = CurrentEditOperation.Execute();

if(!result)

{

   var errorMessage = CurrentEditOperation.ErrorMessage;

}

Reply
0 Kudos