Select to view content in your preferred language

Attribute Rules constraint issue

686
2
Jump to solution
08-03-2021 11:58 AM
V1212
by
Emerging Contributor

Hi, Im trying to create a constraint that prevents a field (name_id) from being edited

I can't figure out what's wrong with this statement: 

if ($feature.name_id !=$feature.name_id)

{

return false;

}

else 

return true;

Thanks for the help! 

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Do you have more information about the issue, what is wrong with the script, or what the behavior of the script is unexpected?

Based on a cursory glance, I think you should be using the $originalfeature global to check if the edit that triggers the rule is changing the attribute for that field (name_id). 

if ($feature.name_id !=$originalfeature.name_id)

Check out the blog here to learn more about the $originalfeature https://www.esri.com/arcgis-blog/products/arcgis-pro/data-management/originalfeature-new-attribute-r...

View solution in original post

0 Kudos
2 Replies
by Anonymous User
Not applicable

Do you have more information about the issue, what is wrong with the script, or what the behavior of the script is unexpected?

Based on a cursory glance, I think you should be using the $originalfeature global to check if the edit that triggers the rule is changing the attribute for that field (name_id). 

if ($feature.name_id !=$originalfeature.name_id)

Check out the blog here to learn more about the $originalfeature https://www.esri.com/arcgis-blog/products/arcgis-pro/data-management/originalfeature-new-attribute-r...

0 Kudos
V1212
by
Emerging Contributor

Thanks, thats exactly what I was looking for! 

0 Kudos