How does the new error management work in Utility Network 4? Status and Error Code attributes are confusing me.

3532
7
Jump to solution
10-05-2020 12:01 PM
ArwenVaughan1
New Contributor II

I am hoping there is someone that has some experience with the Utility Network 4 Dirty Areas layer. The Utility Network no longer renders dirty areas as point, line, and polygon features, but just a single polygon layer. Also, the attribute data for storing error information is very different, with bitwise operations to store attributes etc. I have read the ESRI documentation about these changes, but I still have many questions. Status and Error Code attributes are confusing me. I understand the bitwise operations that lead to the Status and Error Code attributes, but only for simple one step operations. I do not understand where the values for these fields come from once you start combining errors to the same feature(s). Anyone have experience with decoding this new approach to error management? Where is the detailed explanation or algorithm for this stuff?

Here is electric Utility Network 4. I stacked two electric devices and then changes their asset type to unknown also.

In my edit-only.png image (After applying edits)...

1. Why did Status change from 8 to 9 when I added a second edit? I understand that Status code 8 corresponds with "3—Feature error". But, what is 9?

2. In this image I do understand the Error Codes, but was surprised that the Error Message attributes are all Null. Why is that?

In my validate-also.png (After running validation)...

3. The Status attributes switched back to 8 after validating. Why? So, this is kind of the same question as number 1.

4. I understand the Error Code values here...they correspond to error 8, 34 and 35. But still the Error Message attributes are all Null? Why?

Thanks in advance for any insight!

1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi Arwen Vaughan , 

Let me simplify the "Error(s)" expression to explain what happens (see expression below). It will loop j from 0 to 63 and do a calculation to see what errors are represented by the code "17213423616". The "errors" variable is an array of error descriptions extracted from the static messages array (excluded from the code below). At the end it will use the Concatenate function to concatenate all the elements (error codes and descriptions) from the errors array and separate them with a new line making each error to appear on its own line:

var code = 17213423616; 
var errors = []; 
var bitMask = 1; 
var i = 0; 
for (var j = 0; j < 64; j++) { 
    Console("code:" + code);
    if ((code & bitMask) > 0) {
        Console(" - i:" + i + "  j:" + j);
        // errors[i++] = static_messages;
        errors[i++] = j;
        Console(" - errors:" + errors);
    } 
    code /= 2; 
    if (code < 1) {
        break; 
    }
} 

return Concatenate(errors, TextFormatting.NewLine);

When you run the code above in the Arcade playground (ArcGIS Arcade | ArcGIS for Developers ) if will return this: each of the two error codes [no descriptions in this case] will appear on a new line:

The console ("Messages" tab) will show this:

code:17213423616
code:8606711808
code:4303355904
code:2151677952
code:1075838976
code:537919488
code:268959744
code:134479872
code:67239936
code:33619968
code:16809984
code:8404992
code:4202496
code:2101248
code:1050624
code:525312
code:262656
code:131328
code:65664
code:32832
code:16416
code:8208
code:4104
code:2052
code:1026
code:513
 - i:0  j:25
 - errors:[25]
code:256.5
code:128.25
code:64.125
code:32.0625
code:16.03125
code:8.015625
code:4.0078125
code:2.00390625
code:1.001953125
 - i:1  j:34
 - errors:[25,34]

View solution in original post

7 Replies
XanderBakker
Esri Esteemed Contributor

Hi Arwen Vaughan , 

When the code changed from 8 to 9 it actually means that it is a combination of 8+1 (=9). In this case 1 represents "Inserted/Updated feature" (a dirty feature before validating). 

The "Error(s)" and "Status Description" are Arcade expressions:

The expression is executed on the fly and when you click a feature it will show the result in the pop-up. The attribute table does not reflect this performance reasons, since it would need to execute it for all records. The best way to evaluate a situation is identify the error feature and check the pop-up (see an example below):

The arcade expressions that are used, are:

Error(s):

var code = $feature.ErrorCode; 
if (code == 0) return; 
var unknown = 'See the online help for this error'; 

var static_messages = ["0: The field has invalid data type.", 
                       "1: The geometry field is null or the geometry is empty.", 
                       "2: Getting subtype value fails or the subtype value is unknown.", 
                       "3: Getting subtype discriminator value fails or the subtype discriminator value is unknown.", 
                       "4: Line feature has fewer than two vertices.", 
                       "5: Line feature has length within tolerance.", 
                       "6: Geometry error could not locate the vertex along the line feature.", 
                       "7: Standalone point feature.", 
                       "8: Invalid connectivity - No junction edge rule.", 
                       "9: Invalid connectivity - More than one junction edge rule applicable.", 
                       "10: Invalid connectivity - The edges are different subtypes and cannot connect.", 
                       "11: An end of an edge has a missing junction.", 
                       "12: " + unknown, 
                       "13: Midspan connectivity not allowed.", 
                       "14: " + unknown, 
                       "15: " + unknown, 
                       "16: " + unknown, 
                       "17: No containment rule.", 
                       "18: No structural attachment rule.", 
                       "19: Multipart line encountered.", 
                       "20: Self-intersecting line.", 
                       "21: Duplicate vertices.", 
                       "22: " + unknown, 
                       "23: The subtype or the discriminator are out of range or the combination is invalid.", 
                       "24: Invalid line feature was discovered during updating subnetwork.", 
                       "25: Stacked point features.", 
                       "26: Invalid device feature was discovered during updating subnetwork.", 
                       "27: Invalid parent subnetwork discovered during update subnetwork.", 
                       "28: Disjoint subnetwork discovered during update subnetwork.", 
                       "29: Inconsistent subnetwork name on multiple subnetwork controllers in the same subnetwork discovered during update subnetwork", 
                       "30: Inconsistent subnetwork name on multiple parent subnetwork controllers in the same subnetwork discovered during update subnetwork.", 
                       "31: Association record is referencing an invalid from or two globalid.", 
                       "32: Error setting weight values.", 
                       "33: Inconsistent asset group or asset type of subnetwork controller discovered during update subnetwork", 
                       "34: Feature or object in unsupported containment relationship", 
                       "35: Feature or object in unsupported structural attachment relationship", 
                       "36: Line feature has invalid terminal", 
                       "37: A feature with the Subnetwork Tap category was found midspan to multiple lines.", 
                       "38: Devices with multiple terminals cannot be midspan.", 
                       "39: Point feature has invalid terminal configuration", 
                       "40: Invalid junction feature was discovered during updating subnetwork.", 
                       "41: Invalid junction object was discovered during updating subnetwork.", 
                       "42: Invalid edge object was discovered during updating subnetwork.", 
                       "43: " + unknown, 
                       "44: " + unknown, 
                       "45: " + unknown, 
                       "46: " + unknown, 
                       "47: " + unknown, 
                       "48: " + unknown, 
                       "49: " + unknown, 
                       "50: " + unknown, 
                       "51: " + unknown, 
                       "52: " + unknown, 
                       "53: " + unknown, 
                       "54: " + unknown, 
                       "55: " + unknown, 
                       "56: " + unknown, 
                       "57: " + unknown, 
                       "58: " + unknown, 
                       "59: " + unknown, 
                       "60: " + unknown, 
                       "61: " + unknown, 
                       "62: " + unknown, 
                       "63: " + unknown]; 

var errors = []; 
var bitMask = 1; 
var i = 0; 
for (var j = 0; j < 64; j++) { 
    if ((code & bitMask) > 0) {
        errors[i++] = static_messages[j];
    } 
    code /= 2; 
    if (code < 1) {
        break; 
    }
} 

return Concatenate(errors, TextFormatting.NewLine);

Status Description:

var status = $feature.Status; 
if (status == 0) {
    return "0: Disabled";
} 

var static_messages = ["1: Inserted/Updated feature", 
                       "2: Deleted feature", 
                       "4: Modified objects", 
                       "8: Feature error", 
                       "16: Object error", 
                       "32: Subnetwork Error"]; 

var statuses = []; 
var mask = 1; 
var i = 0; 
for (var j = 0; j < 6; j++) { 
    if (mask > status) {
        break;
    } 
    if ((status & mask) > 0) {
        statuses[i++] = static_messages[j];
        }
    mask *= 2; 
} 

return Concatenate(statuses, TextFormatting.NewLine);
ArwenVaughan1
New Contributor II

Thank you so much Xander!

Ok, I should have caught the summing of the Status. So 2^3 = 8 and 2^0 = 1 and then you are summing them to get a Status of 9. The documentation does say something kind of along those lines.

How about a follow up question? How do you guys, in this case, get both error codes in the popup...  25 and 34? I am not following how that is encoded somewhere in the attributes. Or is it stored in another table, etc.?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Arwen Vaughan , 

Let me simplify the "Error(s)" expression to explain what happens (see expression below). It will loop j from 0 to 63 and do a calculation to see what errors are represented by the code "17213423616". The "errors" variable is an array of error descriptions extracted from the static messages array (excluded from the code below). At the end it will use the Concatenate function to concatenate all the elements (error codes and descriptions) from the errors array and separate them with a new line making each error to appear on its own line:

var code = 17213423616; 
var errors = []; 
var bitMask = 1; 
var i = 0; 
for (var j = 0; j < 64; j++) { 
    Console("code:" + code);
    if ((code & bitMask) > 0) {
        Console(" - i:" + i + "  j:" + j);
        // errors[i++] = static_messages;
        errors[i++] = j;
        Console(" - errors:" + errors);
    } 
    code /= 2; 
    if (code < 1) {
        break; 
    }
} 

return Concatenate(errors, TextFormatting.NewLine);

When you run the code above in the Arcade playground (ArcGIS Arcade | ArcGIS for Developers ) if will return this: each of the two error codes [no descriptions in this case] will appear on a new line:

The console ("Messages" tab) will show this:

code:17213423616
code:8606711808
code:4303355904
code:2151677952
code:1075838976
code:537919488
code:268959744
code:134479872
code:67239936
code:33619968
code:16809984
code:8404992
code:4202496
code:2101248
code:1050624
code:525312
code:262656
code:131328
code:65664
code:32832
code:16416
code:8208
code:4104
code:2052
code:1026
code:513
 - i:0  j:25
 - errors:[25]
code:256.5
code:128.25
code:64.125
code:32.0625
code:16.03125
code:8.015625
code:4.0078125
code:2.00390625
code:1.001953125
 - i:1  j:34
 - errors:[25,34]
ArwenVaughan1
New Contributor II

Fantastic. Thank you for the detailed description. Cheers!

ArwenVaughan1
New Contributor II

Thanks again for all your help! I do have one more quick question. Do you have any idea why my Error Message attributes are always Null. According to the documentation the Error Message field in the popup window should contain information about the rule violations..."9,RuleID(s) 276,962".

But you can see in my screenshot that it is always NULL even when there are multiple error codes. Do you think this is a configuration issue? Have you seen this before?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Arwen Vaughan ,

Not sure why you are getting an empty Error message field. I just checked locally and the field is filled in my case:

Maybe it is best to contact support and see what is happening.

Just to add some additional info; I am running ArcGIS Pro 2.6.2 and my version 4 UN is stored in a local FGDB. 

PaulLeBlanc1
Esri Contributor

There are only certain error codes that have dynamic error message text. For these error codes, the dynamic portion is written to the error message field.