Execute an attribute rule manually

2197
9
10-20-2020 01:56 PM
JoeBorgione
MVP Emeritus

I think someone one showed me how to do this, but I just can't remember.  Here is my scenario:  I have an existing feature class to which I added a couple of fields.  Those fields are to be populated as a concatenation of some other field values.

What I did to run them manually was first set them for insert and modify.  Then I selected all the features, and in one of the fields I have the new concatenation rules set, I simple hit the space bar while in the selected attributes pane.  That's enough for a modification so both rules fired and I'm good to go.

However, that's sort of a hack; I thought there is a way to execute a rule manually without even making a phony modification.

That should just about do it....
0 Kudos
9 Replies
DanPatterson
MVP Esteemed Contributor

Joe Borgione‌ are you talking about "Immediate Calculations"?

Calculation attribute rules—ArcGIS Pro | Documentation 


... sort of retired...
0 Kudos
JoeBorgione
MVP Emeritus

Not exactly: these rules are specifically set up to fire when a feature is either added or modified so they fall in the class of Immediate Calculations.  Basically all the features are already in the feature class and I added a couple of fields;  I wrote the rules just to get some practice; I could have just used the field calculator, but where is the fun in that?

That should just about do it....
0 Kudos
DanPatterson
MVP Esteemed Contributor

Have you made a custom toolbox that performs the repetitive add fields, and loads your calculations that you use most often?  that would be fun


... sort of retired...
0 Kudos
JoeBorgione
MVP Emeritus

I asked around and there is no 'button to click' to execute an attribute rule on demand.  What was shown me was essentially the same thing I mention above: select a record and simply run a field calculation on the field with the rule and it will fire.

That should just about do it....
0 Kudos
HusseinNasser2
Esri Contributor

This is probably what you are looking for Joe, Batch Calculation / Validation Rules which can be executed through the Evaluate method in error inspector in Pro or through the REST end point.

 

Video here

https://community.esri.com/t5/attribute-rules-videos/create-publish-and-work-with-batch-calculation-...

 

LeonS
by
Occasional Contributor III

I am also looking for the ability to run an attribute rule manually.  I'm attempting to reproduce some of the rules I had set up using the Attribute Assistant in ArcMap, as I migrate my data editing to Pro.  I've found some particular rules executing automatically causes more problems than it is helpful.

I was beginning to look into the Batch Calculation, but it seems that only a workspace w/ branch versioning or FGDB is supported.  https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/evaluate-attribute-rules.ht...

I am working with an SQL Server geodatabase w/ "traditional" versioning.  Is this supported?  If not, is it coming?  Is setting up a feature service also a requirement?  There is just one editor, so these seems like an awful lot of overhead if I need to set up a service. 

Edited -

I see that branch versions are only editable through a web feature service.  https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/branch-version-scenarios.ht...

 

 

Leon

 

 

0 Kudos
TerriWaddell1
New Contributor III

Just wondering if you'd ever gotten anywhere with running an attribute rule manually?  I have the same problem - - I used AUTONUMBER in Attribute Rules but under the manual option because I don't want every feature auto-numbered, just the occasional one.  I don't see a way to make an attribute rule when I only need to run it occasionally.

0 Kudos
HusseinNasser2
Esri Contributor

The only way to run an attribute rule manually is to use batch calculation rule using Evaluate method. 

For your use case however, I think you can still use immediate calculation rule and have a special field in the class (call it trigger (true or false)) when creating a feature have the trigger default to false and only when you flip the trigger field to true the rule can execute. 

 

The rule will look something like this

 

if ($feature.trigger == 'true') return NextSequenceValue('seq');

return;

 

This is another way you can execute the rule manually. 

 

 

JohannesLindner
MVP Frequent Contributor

Be sure to reset the trigger, else the sequence field will be calculated every time you edit it:

if($feature.trigger == "true") {
    return {result: {attributes: {trigger: "false", sequence_field: NextSequenceValue("seq")}}
}
return

 


Have a great day!
Johannes