Select to view content in your preferred language

How to create and calculate multiple fields within the same model

711
2
Jump to solution
09-01-2022 07:49 AM
Chase_Mohrman
Emerging Contributor

Hello. This is my first post. Thanks for understanding!  However, I'm not very good at ModelBuilder. 

 

I am creating a model that joins a feature dataset with a table, deletes some fields, adds other fields, and calculates those new fields. I am not able to add fields AND calculate them at the same time. I can use the "Add Fields (multiple) tool tool to add fields, but then feeding the result into "Calculate Fields (multiple) does not work. The "Calculate Field" (singular) tool does allow you to create a new field AND calculate it at the same time...but it will only do one field at a time.

 

Perhaps I need to use the iterator? Can I make a list of fields that need calculating and make the iterator do a single field calculate? I'm not sure which iterator I need and how to connect it.

 

Thanks for your help!

0 Kudos
1 Solution

Accepted Solutions
TomGeo
by
Frequent Contributor

Hi, and welcome!

Those that are good with ModelBuilder will most likely have an answer on how to do these things in ModelBuilder, but I would suggest you give Python a try.

All the things you can do in ModelBuilder you can do as well in Python, and so much more. Adding a jupyter notebook to your project is so easy, and especially for learning and testing purposes it is simply awesome. To add a notebook you go Insert -> [Project group] -> New Notebook.

Keeping control over things in a script is much easier than dealing with ModelBuilder, and as soon as you need to have more than one iteration within your model you are doomed, or you go the inception way and create models in models, because there can be only one iterator in one model...

 

Best of luck

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!

View solution in original post

2 Replies
TomGeo
by
Frequent Contributor

Hi, and welcome!

Those that are good with ModelBuilder will most likely have an answer on how to do these things in ModelBuilder, but I would suggest you give Python a try.

All the things you can do in ModelBuilder you can do as well in Python, and so much more. Adding a jupyter notebook to your project is so easy, and especially for learning and testing purposes it is simply awesome. To add a notebook you go Insert -> [Project group] -> New Notebook.

Keeping control over things in a script is much easier than dealing with ModelBuilder, and as soon as you need to have more than one iteration within your model you are doomed, or you go the inception way and create models in models, because there can be only one iterator in one model...

 

Best of luck

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
Chase_Mohrman
Emerging Contributor

Thanks. I think ModelBuilder will not solve this problem but I will have to use python. Thanks again.