ArcGIS Pro - AttributeRule - Trigger - Should trigger only for update on one specific column

358
3
Jump to solution
03-07-2023 12:49 AM
Vara_PrasadM_S
Occasional Contributor II

Hi Team,

I am using ArcGIS Pro V 3.0.3. I am planning to add an Attribute Rule on Feature Class - B to copy value from Field1 of Feature Class - A, based on value from Field2 of Feature Class B.

I would like to add Attribute Rule for Insert trigger only, however, by that time, Feature Class B's new feature may not have value for Field2. So, have to include Update trigger also. 

In this scenario, how can we control execution of Attribute Rule only on update of Field2 value of Feature class B and not on any kind of Update.

Thanks in advance!

With Regards,

Vara Prasad

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Using the $originalFeature object, you can check to see which attributes are edited. We do this with one of our services, where we want to pass 4 attributes to other layers, but avoid needlessly triggering the rule when other attributes are edited.

if ($originalFeature['some_field'] == $feature['some_field']) {
    Console('Key attribute not changed')
    // leave feature unchanged
} else {
    Console('Key attribute changed, passing update to other layer')
    // execute your expression to update the other layer
}

 

- Josh Carlson
Kendall County GIS

View solution in original post

3 Replies
jcarlson
MVP Esteemed Contributor

Using the $originalFeature object, you can check to see which attributes are edited. We do this with one of our services, where we want to pass 4 attributes to other layers, but avoid needlessly triggering the rule when other attributes are edited.

if ($originalFeature['some_field'] == $feature['some_field']) {
    Console('Key attribute not changed')
    // leave feature unchanged
} else {
    Console('Key attribute changed, passing update to other layer')
    // execute your expression to update the other layer
}

 

- Josh Carlson
Kendall County GIS
Vara_PrasadM_S
Occasional Contributor II

Hi @jcarlson ,

Thanks for the suggestion. This logic is working fine with Update trigger, however, its not working in case of Insert trigger.

So, used below in conjunction with your suggestion. 

$editcontext.editType

Thanks & Regards,

Vara Prasad

jcarlson
MVP Esteemed Contributor

Oh, good point! There's no "orginalFeature" when it's an Insert. Thanks for amending the expression!

- Josh Carlson
Kendall County GIS
0 Kudos