0

I am trying to combine multiple fields using the iterate fields in ArcGIS Pro ModelBuilder. I can iterate through and get the combined values but it only gives me the combination of one row, therefore I have no way to calculate a new field with these fields merged together for all rows in the table. The main aim is to use wildcard for all columns starting with soil_type and concatenate into a new field but it always calculates the same values.

Can this be done or will it only work for updating features based on only these fields? Image shows what I want to achieve. I want to do do this once a week but the soil type fields are not consistent iterate fields to calculate combined fieldenter image description here

2
  • 1
    Please show an example of your data and what you want to achieve, edit your question.
    – Hornbydd
    Mar 22, 2021 at 18:58
  • Double check that when you're iterating the current row is being referenced, rather than just the first or last row. I'm not very familiar with ModelBuilder, but it sounds like you've got a situation similar to updating a variable in a for loop but then using the variable after the for loop finishes, rather than using it each time through the loop. This page of Esri documentation shows an example of a model using their Iterate Field Values tool. Mar 22, 2021 at 20:25

1 Answer 1

1

You do not need to use an iterator if you want to create your combined field.

  1. Create you text field combined, make sure its long enough, so in your example a text field of 20 characters would be sufficient. Use Add Field tool to create it.
  2. Run the Calculate field tool, your expression would be !Soil_Type1! + ", " + !soil_type2!. If you don't know what the field calculate tool is please read the help file and study it's page.

The Calculate Field tool will honour selections; so with no selection, the expression is applied to each row.

4
  • The reason I am thinking of field iterator is that the files I import do not necessarily have the same soil type fields. File 1 could have soil_type1 soil_type3 and the following weeks file have soil_type 4 soil_type 5 etc. There is normally up to 10 soil types from samples. This is why I don't want to update the expression each time to calculate the field.
    – Robert
    Mar 22, 2021 at 21:04
  • What you want to do cannot be achieved by model builder, this is a relatively trivial issue if scripted in python.
    – Hornbydd
    Mar 22, 2021 at 22:29
  • Thank you for the comments. I have no experience with python. Would anyone have a sample script to search for fields containing Soil_Type and then concatenate?
    – Robert
    Mar 24, 2021 at 19:33
  • Hi Hornbydd, I have updated my initial post to show my model. The top image is the submodel and bottom is my main model but I don't exactly know how to put in a loop statement in the calculate field code block to select the iterator outputs and combine for each row. This is based on wildcard.
    – Robert
    Mar 29, 2021 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.