Association Already Exists, Duplicate Association Found Error !

231
0
04-07-2022 12:07 AM
GIS_Solutions
Occasional Contributor II

Hi everybody,

I have a data model with a utility network in it. I wrote a rule that will establish an attachment association between poles (structurejunction) and connection points (electricjunction). I configured it to trigger on update instant. But I couldn't get rid of getting the following error. 

The error It points to a different attachment association that is always present.

where am i making a mistake?

association exists.jpg

//$feature is an ElectricJunction
var sjFeatureSet = FeatureSetByname($datastore, "StructureJunction", ["objectid"] ,false)
// Asset Group 101-102-103-104-105
// Asset Type 
var polesFeatureSet = Filter(sjFeatureSet, "ASSETGROUP in (101,102,103,104,105) AND ASSETTYPE in (110,111,112,120,121,122,130,131,132,133,134,381,382,383,470,471,473,474,475,476,477,478,479,480,481,482)")
//buffer
var g = buffer($feature, 1)

var intersectedPoles = Intersects(polesFeatureSet,g)

if (count(intersectedPoles) == 0) 
  return $feature.notes;

var pole = first(intersectedPoles)

return {

         "result": $feature.notes,
         "edit": 
              [
                {
                 "className": "structurejunction",

                 "updates":
                 [
                   {
                   "objectID": pole.objectid,
                   "associationType": 'structure'
                   }
                 ]
                }
              ]
            }

 

0 Kudos
0 Replies