In ArcGIS ModelBuilder is it possible to use a %Name% field value from iterated features in a query and, if so, what syntax should I use?

enter image description here

  • Are you familliar with Python? – JuniorPythonNewbie Oct 25 '18 at 13:28
  • Yes but already solve it with python. Im interestred with use of simple ArcGis Desktop functionalities – Markoyee Oct 26 '18 at 13:30

Yes. You'd use the inline variable in the exact same way you're using it in your output featureclass. %Name%.

Inside your Select tool, build up your expression something like:

'"the_field" = \'%Name%\''

However -- I question your overall workflow. You're iterating over FeatureClasses and getting the "name" of the featureclass. Your workflow as-is means the Name of the featureclass is going to be used to "select" a row (matches an attribute) in another featureclass. I suppose that could be valid, it just seems unlikely.

  • Yes you got right, this model is simplified just to show the problem i like to solve... :) I tested your solution '"the_field" = \'%Name%\'' on my specific case names but the phrase didnt worked ! Can You describe how single quotation marks & backslash are changing the execuction of staement ? – Markoyee Oct 27 '18 at 20:31
  • I took the \' .. \' right from the help. You may need to tweak the escapes and slashes depending on your field type to create a proper expression. – KHibma Oct 29 '18 at 12:50

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.