0

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", "")
Kadir Şahbaz
78.6k57 gold badges260 silver badges407 bronze badges
asked Sep 21, 2021 at 20:04
2
  • 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. Commented 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. Commented Sep 21, 2021 at 20:20

1 Answer 1

2

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.

Model

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.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
answered Sep 21, 2021 at 20:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.