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.
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"
}
]},
]
}
Thank you so much for the quick response, and for providing a neat alternative that works.