ArcGIS Pro Gas Utility Network - Arcade Attribute Rule Issue

402
4
Jump to solution
02-15-2024 03:34 PM
MapEnthusiast1993
New Contributor II

Greetings!  Struggling with Arcade and an attribute rules and seeking help from the community.

I am working on a project where a gas client is migrating data to the UPDM and utility network using ArcGIS Pro. They have been using Pro a little bit, and within their existing gas geodatabase, they have a feature dataset for Gas Leak data. Within that dataset, they have an existing/old layer called G.Identified_Issues and they are migrating this layer into to the UPDM feature class called P.Identified_Issues. Their existing/old Identified_Issues layer has 5 attribute rules (ARs), one of which is not working. I need to ensure all the ARs are set (wording can change within the Arcade expression and likely will since the layer names are a little different with UPDM).

The problem AR is a calculation type with a description stating: "New Identified Issues created by the application will populate the address field to the nearest Gas Meter: FULL_ADDRESS. The user will be able to edit the field afterwards if needed."

The problem portion of the problem AR is this piece of the script expression that states:
var meters = FeatureSetByName($datastore, "{361B7729-29FC-47DE-852A-D2172492C5BF}", ["Full_Address"], true)

Unfortunately the table/layer it is referencing in {} has a name formatted like a globalID, but I can't find that ID anywhere in the existing data (searched gas meters layer for that globalID and also searched client ArcGIS Portal but no luck) and the client also is unsure why it is referencing a table that is named like that. The client also said that it should be searching for the nearest record in GasMeters (old layer) from SDE. GasMeters as an old standalone layer has migrated to PipelineDevice in the UPDM/Utility Network dataset and meters can be queried out with ASSETGROUP = 2.

When I import the AR without changing anything, Pro gives me an error that states "ERROR 002717: Invalid Arcade expression, Arcade error: Table not found {361B7729-29FC-47DE-852A-D2172492C5BF}, Script line 3 [ORA-00931: missing identifier]"

Does anyone have any suggestions as to why the existing AR expression is referencing a table written like that? The client said "it should be searching for the nearest record in GasMeters from SDE. I'm guessing that's what it is doing but I don't know why the Arcade expression is written that way."

And the biggest question - does anyone know how to reword this portion of the Arcade expression so that it is referencing PipelineDevice ASSETGROUP=2 in order to still do the same thing?

Thank you so much in advance - this is a stumper for me.

0 Kudos
1 Solution

Accepted Solutions
MikeMillerGIS
Esri Frequent Contributor

That GUID represents a moniker to a table which is needed when the data is published.  Since it shows the GUID, it means the table it references no longer exist.

Just change it to the reference the PipelineDevice and wrap the FeatureSet in a Filter and use the SQL to filter to only gas meters

View solution in original post

0 Kudos
4 Replies
MikeMillerGIS
Esri Frequent Contributor

That GUID represents a moniker to a table which is needed when the data is published.  Since it shows the GUID, it means the table it references no longer exist.

Just change it to the reference the PipelineDevice and wrap the FeatureSet in a Filter and use the SQL to filter to only gas meters

0 Kudos
MapEnthusiast1993
New Contributor II

Thanks so much!  This is all new to me so that's great to know about the table not existing anymore.  

So if I replace this line referencing old data/table:
var meters = FeatureSetByName($datastore, "{361B7729-29FC-47DE-852A-D2172492C5BF}", ["Full_Address"], true)

with this new line referencing new UPDM data: 
var meters = Filter(FeatureSetByName($datastore, "PipelineDevice", ["Full_Address"], true), "ASSETGROUP = 2")

that should suffice?

Here's the full script expression but I believe based on the error, it's just the 3rd line that's the issue:

var searchDistance = 0.5;
var searchMetric = "mile";
var meters = FeatureSetByName($datastore, "{361B7729-29FC-47DE-852A-D2172492C5BF}", ["Full_Address"], true);
var meterCandidates = Intersects(meters, Buffer($feature, searchDistance, searchMetric));
var nearestMeter = null;
var minDistance = Infinity;
for (var meter in meterCandidates) {
var d = Distance(meter, $feature, searchMetric);
if (d < minDistance) {
minDistance = d;
nearestMeter = meter;
}
}
if (nearestMeter != null) {
return {
"result": nearestMeter.FULL_ADDRESS
}
}
else {
return $feature.ADDRESS
}

0 Kudos
MikeMillerGIS
Esri Frequent Contributor

var meters = Filter(FeatureSetByName($datastore, "PipelineDevice", ["Full_Address"], true), "ASSETGROUP = 2")

 

lgtm

MapEnthusiast1993
New Contributor II

thank you so much for your help!

0 Kudos