I need help with field calculations for more than 20 fields. I have to do this task on joined table. I used CalculateField
tool in ModelBuilder.
Is there a way to call all 20 fields in the tool and update all of them at once? Here is my code below:
I am joining two tables based on EQUIP_ID
:
arcpy.AddJoin_management(ABC_WATERLINE_COPY, "EQUIP_ID", WATERCHANNEL_123, "EQUIP_ID", "KEEP_COMMON")
Here is my code below to field calculate on joined table. It's just on one field and I have to do the same for 20 more fields:
arcpy.CalculateField_management(ABC_WATERLINE_COPY,"ABC_WATERLINE_COPY.NUMBEROFPLANTS", "[WATERCHANNEL_123.NUMBEROFPLANTS]", "VB", "")
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.Community– Community Bot2021年09月21日 20:12:39 +00:00Commented Sep 21, 2021 at 20:12
-
I need to field calculate 20 plus fields using CalculateField tool in model builder, looking for some ways to field calc all 20 plus fields since the tool required to add one field at a time. I hope this clear my query.SAM– SAM2021年09月21日 20:20:07 +00:00Commented Sep 21, 2021 at 20:20
1 Answer 1
As you have tagged your question as ArcMap and you are seeking a ModelBuilder solution; the easiest solution is to chain 20 Field Calculate tools as shown below, each one calculating on a different field.
If you feel that this makes your model too long to look at then try embedding the chain of Calculate Field tools model into a master model?
A more complex solution is to run an UpdateCursor in a Calculate Value tool which allows you to run short scripts within ModelBuilder.
If you have ArcGIS Pro, and are open to using that instead, then there is the Calculate Fields tool.
Explore related questions
See similar questions with these tags.