AnsweredAssumed Answered

ArcGIS Pro 2.6 Model Builder: Calculate Field or Calculate Value Using Inline Variable Substitution

Question asked by Brian.Acheff on Aug 4, 2020
Latest reply on Sep 8, 2020 by Brian.Acheff

I have a feature class that consists of county wide addresses that need to be exported to a .shp and then "Find & Replace" so all fields that have attributes with COUNTY ROAD, US HIGHWAY, STATE ROAD, STATE HIGHWAY to be changed to CO RD, US HWY, ST RD, ST HWY for a computer aided dispatch software to consume. 


This is usually a manual process, in which the .shp is kicked out and using the attribute tables capacity to mass "Find & Replace". But our system growing, having these types of tasks automated is going to be essential. 


So far in model builder getting the FC to .shp is obviously self explanatory, but the road block I have ran into is whether to use CALCULATE FIELD or CALCULATE VALUE and whether to use ITERATE FIELDS or ITERATE FIELD VALUES

 to iterate through two newly create .shp for Address Points and a Road Centerline that have mutiple fields which contain street name prefix types (eg. COUNTY ROAD, US HIGHWAY, STATE ROAD, STATE HIGHWAY) and convert them to a notation that our PD CAD software can cosume as mention above (eg. CO RD, US HWY, ST RD, ST HWY).


Using either CALCULATE FIELD or CALCULATE VALUE will obviously prompt me for a python expression that will perform an inline variable substitution, that being said which of the two tools would be best and what iterator would be best?


I have provided links to two examples where each of the tools is used to perform the "Find & Replace".


Attribute Value Correction Using ModelBuilder  


Getting Started with Model Builder | Map and Data Library 


Inline Variable Substitution Test Expression 


"%VALUE%".replace("Find", "Replace") OR !VALUE!.replace(%FIND%, %REPLACE%)