Hi all,
I would like to be able to update all the features which have the same attribute. For example, all features that has a field 'ID' with value 1, i would like all the features to have the field 'Result' updated with 'Yes' when a 'Yes; is entered into 1 feature.
I believe i need to filter the layer but i cant work out how to do this.
Any help would be greatly appreciated.
Are you planning to do this using attribute rules, or a field calculator? An attribute rule might look like
var i = $feature.ID
var r = $feature.Result
// if ID is 1, enter 'Yes' in result, otherwise leave empty)
var resultValue = When(i==1,'Yes','')
return resultValue
If you want to use a field calculator, you would do a Select by Attribute:
WHERE ID = 1 (or, WHERE ID 'is equal to' 1)
Then your attribute table will have only 1's selected, and you can run your field calculator and enter 'Yes' into the value box.
The other question is are you talking about different features within the same feature class or the same ID in multiple feature classes. If it is the first then a field calculation using @ZachBodenner solution would work.
A simpler way to write @ZachBodenner attribute rule is:
iif( $feature.ID == 1 && $feature.Result != 'YES' , 'YES' , $feature.Result )
But that is assuming that you simply don't want any changes, otherwise you can change $feature.Result to NULL or whatever returned value you want in its place.
If it is the latter then you would need to use an attribute rule for a python script to accomplish that.
Hi,
Thank you, i would like to do this in field maps. When one record 'Result' is updated, i want all the other features 'Result' field to update too where ID = 1.
You should absolutely be able to do this in Field Maps. In your form designer, click on the Results atteibute and click calculated expressions. Here's an example from an app of mine:
Then you can basically use the same code that either myself or @RPGIS provided.
Hi Zach,
I don't understand how that will update all the features in the feature layer which have an id of 1? It looks like it only updates the current feature.
Thank you
James
Oh I see what you're saying here. So in Field Maps, this will affect all future additions to the dataset. If you need to do it in batch, then @RPGIS is right, you can't do that in Field Maps and you'll need to use the Field Calculator.
I want it to update all the features in the dataset at the same time when a value is entered in the form. I tried using the calculate field but i cant use arcade due to sync and i doint know how to do this in SQL either. I dont even know if this will run all the time or if it just a one off calculation.
I will have to create a python script as a scheduled task
What kind of versioning are you using if you are using any at all.
It sounds like you are using batch versioning which would require that you to disable the service, delete the version possibly, apply the edits/create the attribute rule, and then re-publish the service.
We are using traditional versioning since we have a lot of back end processes that run in SQL so I am a little unfamiliar with the batch versioning.
This capability must have been added for Enterprise releases 11.0 and later. We are currently using 10.9.1 which is why I originally thought it wouldn't work. I suppose with later updates that this will be possible.