Select to view content in your preferred language

Attribute Rule to add an Object record to both terminals of a device

895
4
02-19-2024 09:58 AM
VanCityUtility
Emerging Contributor

Hi there, 

I've been working with Utility Network version 6 and ArcPro 3.1.  My UN has features and non-spatial objects.  Many devices require associated units for both containment and connectivity, so I'm trying to create an attribute rule that automatically creates the object record and sets all associations on insert.  The problem arises when I attempt to add connectivity records to both terminals:

Electric Device:  Transformer

Terminals:  High Side and Low Side

Electric Junction Object:  Transformer Unit

The following code does not work - I receive an error  "Failed to create Overhead Transformer.
The feature and terminal specified already participate in a connectivity association. "

 

 

return {
"result": $feature.notes,
"edit": [
    {  
    "className" : "ElectricJunctionObject", 
    "adds" : [{
        "tag": "unit1",
        "attributes": {
            "assetgroup": 100,
            "assetType": 101}
             }]},
    {
    "className": "^UN_Association",
    "adds": [{
            "fromClass": "ElectricDevice",
            "fromGlobalId": $feature.GLOBALID,
            "toClass": "ElectricJunctionObject",
            "toGlobalId": "unit1.globalID",
            "associationType": "containment"
            }]},
    {
    "className": "^UN_Association",
    "adds": [{
            "fromClass": "ElectricDevice",
            "fromGlobalId": $feature.GLOBALID,
            "toClass": "ElectricJunctionObject",
            "toGlobalId": "unit1.globalID",
            "fromTerminal": "High Side",
            "associationType": "connectivity"
            }]},
    {//Adding this third record gives me the error stated above.
    "className": "^UN_Association",
    "adds": [{
            "fromClass": "ElectricDevice",
            "fromGlobalId": $feature.GLOBALID,
            "toClass": "ElectricJunctionObject",
            "toGlobalId": "unit1.globalID",
            "fromTerminal": "Low Side",
            "associationType": "connectivity"
            }]}
         ]
        }

 

 

 

I do have success when I remove the third section (lines 32-39), so I can get one containment and one connectivity record.

Everything works as expected when associations are set in Pro manually.  Does anyone have advice on how to add the object to both terminals of the device?  Thanks in advance.

0 Kudos
4 Replies
HusseinNasser2
Esri Contributor

Thanks I can reproduce it looks like a bug when the association is being added in multiple payloads, we will take a look.

 

Meanwhile the workaround is to group all associations in one payload.  

 

return { 
"edit": [
    {  
    "className" : "ElectricDistributionJunctionObject", 
    "adds" : [{
        "tag": "unit1",
        "attributes": {
            "assetgroup": 2,
            "assetType": 1}
             }]},
    {
    "className": "^UN_Association",
 
    "adds": [{
            "fromClass": "ElectricDistributionJunctionObject",
            "fromGlobalId": $feature.GLOBALID,
            "toClass": "ElectricDistributionJunctionObject",
            "toGlobalId": "unit1.globalID",
            "associationType": "containment"
            },
{
            "fromClass": "ElectricDistributionJunctionObject",
            "fromGlobalId": $feature.GLOBALID,
            "toClass": "ElectricDistributionJunctionObject",
            "toGlobalId": "unit1.globalID",
            "fromTerminal": "Source",
            "associationType": "connectivity"
            },
{
            "fromClass": "ElectricDistributionJunctionObject",
            "fromGlobalId": $feature.GLOBALID,
            "toClass": "ElectricDistributionJunctionObject",
            "toGlobalId": "unit1.globalID",
            "fromTerminal": "Load",
            "associationType": "connectivity"
            }
]},
   
         ]
        }

 

 

 

 

0 Kudos
VanCityUtility
Emerging Contributor

Thank you so much for the quick response, and for providing a neat alternative that works.

0 Kudos
Joel_EWEB
New Contributor

post moved down

0 Kudos
Joel_EWEB
New Contributor

Hello Hussein,

I have a very simple scenario where I am creating a ServicePoint with a template so the ServicePoint will already contain a single ElectricJunctionObject:meter. I would also like to connect the ServicePoint to the same meter. 

My main question is about sequence - which fires first upon feature creation: the creation of the contained  meter and containment association or the attribute rule?

Joel_EWEB_0-1749076047901.png

I am interested in adapting this script so it only creates the Junction - Junction Connectivity association.  I would use FeatureSetByAssociation to grab the ElectricJunctionObject:meter GlobalId from containment (if it exists at this point) and use it in "toGlobalId": "meter.globalID" to insert connectivity.

0 Kudos