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

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.
    – Bjorn
    Feb 7 '20 at 21:32
  • Through feature classes in a .gdb.
    – gwydion93
    Feb 7 '20 at 22:26
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.

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.
    – gwydion93
    Feb 10 '20 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.
    – fatih_dur
    Feb 11 '20 at 1:45

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.