1

I am using "Iterate Row Selection" in ModelBuilder to run through every line of a table. I am able to have the iterator create a rolling variable (Value), by selecting a field in "Group by Fields."

If I "Group by Fields" on the field CNTRY_NAME, the iterator creates a value for that record on each iteration (i.e. Afghanistan). I can then plug the variable into a different part of the model as an input.

I would like it to create a second value for an additional field (i.e. CNTRY_ID) on each iteration, based on the current selected record. By default, the iterator only creates one value.

If I add an additional field into the Group By Fields, the fields are concatenated, and I still only get one "Value" variable.

ModelBuilder enter image description here

Is there a way to create an additional "Value" variable from an iterator in ModelBuilder?

1
  • Can you amend your question to explain what you mean by an "additional" value. What is this additional value and where would it come from?
    – Hornbydd
    Oct 25, 2017 at 21:42

1 Answer 1

1

This can be achieved using the model only tool Get Field Value as shown below:

Using Get Field tool

This logic works as your iterator is creating a virtual table of just one row per country. So you can use this tool to pull out any other field value in your "one row table". In the example above you can then use %country ID% in any inline substitution.

2
  • THANK YOU! The "Get Field Value" tool doesn't appear in a basic search. That toolset is hidden within the ModelBuilder window under "Insert."
    – Map Man
    Oct 26, 2017 at 14:26
  • 1
    I don't think any of the model only tools appear in the search panel, just something you learn about after banging your head against a very hard brick wall! :)
    – Hornbydd
    Oct 26, 2017 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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