1

I am trying to build a model that iterates through feature classes in a .gdb and uses the name of feature class (they are named by state abbreviations) to make a new layer from a second feature class based on that name. enter image description here

The second feature class, osm_bing_diff_uniqueid has a field called st_abbr that identifies a feature by state abbreviation. What I want to do is parse the Name output of the first feature class into the expression for the Make Feature Layer of the second feature class. For example, if the Name = AL_Bldg_FP_Parcels, I to make a feature class of all the features in osm_bing_diff_uniqueid where the st_abbr field value is AL. I am a little confused as to how to use the Name as an input and parse it into the expression.

Any suggestions? Fe

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Feb 7, 2020 at 21:11
2
  • 2
    Are you iterating through the features in a single feature class, or through a number of feature classes in the .gdb? The first sentence isn't clear. Commented Feb 7, 2020 at 21:32
  • Through feature classes in a .gdb. Commented Feb 7, 2020 at 22:26

1 Answer 1

1

You can use Calculate Value (from model only tools) to get this value. If you put this python expression in Expression argument, %Name%[:2], it should give the first two letters of the Name in-line variable in a new variable, output_value by default. Then you can introduce this into your query builder as in-line variable, for example, "st_abbrv" = '%output_value%'.

UPDATE

You should introduce Calculate Value both preconditioned to the Name iterator output and as a precondition to the Make Feature Layer.

answered Feb 8, 2020 at 11:26
2
  • Do I need to use code block somehow in connecting Name as an input to Calculate Value? When I add "Name%[:2] " (or anything other than just Name), the connection arrow disappears. Should I just use Name as a precondition to running Calculate Value? Everytime I iterate through the .gdb, I want it to get a new Name and calculate a new output_value to input in my Make Feature Layer process. Commented Feb 10, 2020 at 14:08
  • 1
    Sorry, I missed that detail, you should introduce Calculate Value both preconditioned to the Name iterator output and as a precondition to the Make Feature Layer. Commented Feb 11, 2020 at 1:45

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.