Attribute rule--drilldown other layers

1073
5
Jump to solution
06-24-2021 12:29 PM
Labels (1)
YinghongLi1
Occasional Contributor

Here is the scenario:

for a newly created feature:

1.  get the center point of the feature polygon.

2.  use the point to query specific layers and get specific values.  these layers are in the same map.

3.  enter the values to the corresponding fields in the feature.

Like to use attribute rule to do this task so the drilldown values are entered during the feature creation.  Not sure if it is doable

We use Oracle/SDE database.

Thanks 

0 Kudos
3 Solutions

Accepted Solutions
DavinWalker2
Esri Contributor

You can certainly Copy the value of an intersecting feature using an Attribute Calculation Rule. Have a look at this ESRI Github Repo for examples.

 

View solution in original post

JohannesLindner
MVP Regular Contributor
// Calculation Rule
// Triggers: Insert

// create centroid
var cent = Centroid($feature)

// repeat this block for each intersecting feature class (change variable names!)
/////
var intersect_feature = First(Intersects(FeatureClassByName($map, "FeatureClass"), cent))
var value = null
if(intersect_feature != null) {
  value = intersect_feature.Value
}
/////

// return the values
return {
  "result": {
    "attributes": {
      "Field1": value_1,
      "Field2": value_2
    }
  }
}

Have a great day!
Johannes

View solution in original post

IamTrash
New Contributor

Not that I am aware of. The analysis is done at the datastore or map level so as long as you are pulling reference data to update feature data is will not matter where the reference data is from. I have updated many features at once using this method when they are all in the same geodatabase, but updating one of the reference features may be an issue if they are not in the same geodatabase. 

View solution in original post

0 Kudos
5 Replies
DavinWalker2
Esri Contributor

You can certainly Copy the value of an intersecting feature using an Attribute Calculation Rule. Have a look at this ESRI Github Repo for examples.

 

JohannesLindner
MVP Regular Contributor
// Calculation Rule
// Triggers: Insert

// create centroid
var cent = Centroid($feature)

// repeat this block for each intersecting feature class (change variable names!)
/////
var intersect_feature = First(Intersects(FeatureClassByName($map, "FeatureClass"), cent))
var value = null
if(intersect_feature != null) {
  value = intersect_feature.Value
}
/////

// return the values
return {
  "result": {
    "attributes": {
      "Field1": value_1,
      "Field2": value_2
    }
  }
}

Have a great day!
Johannes
YinghongLi1
Occasional Contributor

One more question.  is there any restriction for drilldown operation, e.g. drilldown feature classes have to be in a same dataset that editing feature class is?

thanks......

 

0 Kudos
IamTrash
New Contributor

Not that I am aware of. The analysis is done at the datastore or map level so as long as you are pulling reference data to update feature data is will not matter where the reference data is from. I have updated many features at once using this method when they are all in the same geodatabase, but updating one of the reference features may be an issue if they are not in the same geodatabase. 

0 Kudos
YinghongLi1
Occasional Contributor

I meant from different database.  we have our own database which we edit and we have a public browsing database we use as reference layers.  we drilldown to feature classes in browsing database to update a new feature created in the editing database.

based on your reply we should be able to do the drilldown operation.  we can't update browsing database anyway.

thanks.....

0 Kudos