How do you dynamically provide the zone fieldname to Zonal Stats as Table in Model Builder?

04-09-2020 11:24 AM
New Contributor II

I have a model, which contains a sub-model (see attached attached).  The main model iterates through feature classes in a gdb and operates on them by passing them to sub-models.  One of these sub-models takes the FC, uses its name to find a corresponding raster, then uses zonal statistics as table to calculate some summary data, join it to the FC and finally delete the join.  At least, that's what I want it to do.  If I use this sub-model on its own and provide the fc and zonal field manually, it works fine.  The problem is I can't figure out how to use the model to provide the field name.

I went to the trouble of ensuring that every FC the main model will encounter has a field simply called 'name', which is a unique field I want to use as the zone field.  I tried to just put 'name' as the zone field in the sub-model's Zonal Stats process, but it gets deleted once I click away from that field.  I tried using a variable, but that didn't seem to work either.  Surely there is a way to do this, but I don't see anything about this in the documentation.

0 Kudos
0 Replies