Error 999999 When Saving Attribute Calculation Rule to Enterprise Geodatabase

927
3
Jump to solution
09-15-2021 07:51 AM
Billy
by
Occasional Contributor II

Hi,

This is my system configuration:

ArcGIS Pro 2.8

Electric Utility Network Version 4

ArcGIS Enterprise 10.8.1

SQL Server 2017

I'm getting this error when trying to save the rule (error and code images at the end) to my enterprise geodatabase (Utility Network in SQL database). The problem seems to be related to the code in the rule because I could save other rules with different code after the error. I think it has to do with my using the $map global in the Attribute Rule Calculation profile. The Arcade documentation is a little confusing about using the $map global in this profile. In the Profile section of the documentation (Profiles | ArcGIS Arcade) it doesn't include the $map global, but the Type System FeatureSetCollection section (Type System | ArcGIS Arcade) of the documentation mentions that the $map global can be used in the Attribute Rules profiles.

The other rules that I was able to save are using the $datastore global to access other class in the database. This rules is trying to access a feature class added to the map from a file geodatabase. I'm trying to avoid having to add the feature class in the file geodatabase to the enterprise geodatabase and then use $datastore global. This process has worked in the past, but now I'm having problems deleting those temporary feature classes from the enterprise geodatabase (Utility Network SQL database) when I don't need them anymore.

So, what I'm trying to do is find a way to allow the Attribute Rule associated to a Utility Network feature class in the enterprise geodatabase to extract data from a feature class in a file geodatabase. I'm not sure if the $map global is the best way to do that.

 

Billy_1-1631715768675.png

Billy_2-1631715979211.png

 

Billy_0-1631715233092.png

// *************       User Variables       *************
// This section has the functions and variables that need to be adjusted based on your implementation

// The field the rule is assigned to
var field_value = $feature.notes;
var source_layer = 'Poles_to_Riser_Disconnect_Match';
var search_distance = 200;
var search_unit = 'feet';
var feat_globalid = $feature.globalID;
// Asset_type allowed
var valid_asset_types = [565];                  // 565 - Overhead Cutout Fused Load Break from Device Class 
// ************* End User Variables Section *************

// Checking for allowed asset types
if (indexof(valid_asset_types, $feature.assettype) == -1) {
    return field_value;
}

//Find the closest pole
var fsSource = FeatureSetByName($map, source_layer,["*"], false)
var fBuffer = Buffer(Geometry($feature), search_distance, search_unit)
var fsClosest = Intersects(fsSource, fBuffer)
var minDistance = Infinity

var fFuse = First(fsClosest)

if (IsEmpty(closestp)) {
    return field_value;
}

return fFuse['STREET']

 

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

Yeah, it's the $map global. The documentation could be clearer on that.

Think about it this way:

Attribute Rules are executed on the database level. The database knows the tables it contains (so it has access to $datastore), but is has no clue about the context in which you are currently using a featureclass (so it has no access to $map).

Popups are executed on the application level. The application knows about the database the queried featureclass is in (it has access to $datastore), and it also knows about the context in which you're using the featureclass (has access to $map).


Have a great day!
Johannes

View solution in original post

0 Kudos
3 Replies
JohannesLindner
MVP Frequent Contributor

Yeah, it's the $map global. The documentation could be clearer on that.

Think about it this way:

Attribute Rules are executed on the database level. The database knows the tables it contains (so it has access to $datastore), but is has no clue about the context in which you are currently using a featureclass (so it has no access to $map).

Popups are executed on the application level. The application knows about the database the queried featureclass is in (it has access to $datastore), and it also knows about the context in which you're using the featureclass (has access to $map).


Have a great day!
Johannes
0 Kudos
Billy
by
Occasional Contributor II

Hi Johannes,

Thanks for the answer.

It makes sense. I think that the documentation should be more clear about this.

In my process of trying to identify the source of the error, I notice that even if I change the global $map to $datastore, on line 20 of the code above, if I used a variable to input the class name ('source_layer') this will also trigger the error 999999. Only when I used the literal name of the class in the database the error was not triggered:

var fsSource = FeatureSetByName($datastore, 'UN_MODEL_V34.MODEL_V34.Poles_to_Riser_Disconnect_Match',['*'], false)

 

0 Kudos
JohannesLindner
MVP Frequent Contributor

Yes, that is a known limitation of Arcade, as explained in  this thread.


Have a great day!
Johannes
0 Kudos