Select to view content in your preferred language

Field Calculator - Autorun the python script after each edit

869
4
12-25-2017 01:16 PM
Muhammed_KamilErsoy
New Contributor

Hi, I am using a script to change the value of a field according to an other field's value. But after each edit on the FC I need to re-run the script in the field calculator to change all the values so I want it to run the script after each edit automaticaly. Is there a way to do that?

Numbers means the coded values from the domains and the active field's name is: "konu_baslik" . 

def calc(field):
if '1' in field:
return '1'
elif '2' in field:
return '2'
elif '3' in field:
return '3'
elif '4' in field:
return '4'
elif '5' in field:
return '4'
elif '6' in field:
return '4'
elif '7' in field:
return '2'
elif '8' in field:
return '2'
elif '9' in field:
return '5'
elif '10' in field:
return '5'
elif '11' in field:
return '6'
elif '12' in field:
return '7'
elif '13' in field:
return '8'


calc( !sikayet_turu! )

Thanks

Tags (2)
0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

no..edit the script, then rerun.  No auto-re-run in the field calculator.  The microseconds that would be saved wouldn't be worth trying to implement this in any event

Muhammed_KamilErsoy
New Contributor

actually I will use this FC in crowdsource so the one field means complaint type and the other field is the header. header will be populated accoring to the complaint type so it is not logical to calculate manually every day or more frequent. I couldn't find any alternative method. Only there is relevant fields in survey123 but I couldn't run them without survey app. I hope, I can explain my situtation

0 Kudos
DanPatterson_Retired
MVP Emeritus

so this isn't a question about arcmap or ArcGIS pro, it is about the functionality of survey123

0 Kudos
XanderBakker
Esri Esteemed Contributor

I guess as Dan mentions this is something you would want to solve in Survey123. The intelligent forms allow you to fill fields based on values in another field. So I will tag https://community.esri.com/groups/survey123?sr=search&searchId=fdef816c-9582-4ad5-9bea-94dbd7bbe1ee&...‌ for more visibility.

In addition to this, the field calculation that you have, will never reach the part of checking for '10', '11', '12' or '13' in the value, since they also contain '1' and will be assigned a '1' as result.