Within a feature class, lock a row in an attribute table to prevent all edits on that specific row. Also, have the ability to select a set of rows and lock them. The problem this would help with is that automated attribute table editing, for me at least, usually ends up with a few exceptions that have to be manually entered. I would like to have the ability to do that manual attribute table editing, lock those rows, and then continue on with automated edits on everything else in the table.
I wonder if you could do something similar to what you want by creating a flag column, populate the flag column, then disallow edits to rows that are flagged -- via an attribute rule. (Although, I'm not sure how you would subsequently un-flag the row afterwards, since the row would be un-editable.)
But I assume the attribute rule would throw an error if your "automated edits" tried to edit those rows. Whereas it sounds like you want your automated edits to ignore the locked rows, not error-out. Is that right? Can you elaborate on your "automated edits"?
Hopefully someone with more experience with Attribute Rules can provide some insight. @JohannesLindner might find this interesting.
Yeah, you could do something like that with Attribute Rules.
As Bud said, create a flag field. Let's make it a text field called "Locked". If its value is "Yes", all edits should be forbidden. If its value is anything else, edits go through.
You can do a simple Constraint Attribute Rule
return !($feature.Locked == "Yes" && $originalfeature.Locked == "Yes")
This will return false (block the edit) if the lock field is and was enabled. This way, you can edit the lock field's value.
This works great for manual edits, as it throws an error in you face, telling you why the edit was blocked:
But it also throws that error for automated edits, which is bad, because the script/tool will stop at the first locked feature.
You can do a Calculation Attribute Rule
// field: empty
// triggers: Update
// if the feature is locked, use the old values, else use the new values
var locked = $feature.Locked == "Yes" && $originalfeature.Locked == "Yes"
var feat = IIf(locked, $originalfeature, $feature)
// create and fill the result dictionary
var result = {geometry: Geometry(feat), attributes: {}}
var fields = Schema($feature).fields
for(var f in fields) {
var field = fields[f]
if(!field.editable) { continue }
result.attributes[field.name] = feat[field.name]
}
// return
return {result: result}
This rule will just silently use the original values if you try to override a locked feature's values. This is good for automated editing, because the script/tool won't error out on locked features. It might be a little confusing for manual editors...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.