1

I have a table showing commuting trips from home to work. home_id represents home and work_id represents work. Now I want to step through the trips table using Iterate Row Selection in ModelBuilder, and get the work_id value. Then use the work_id value to select the corresponding feature in the work location feature class at each iteration.

I used Get Field Value tool in ModelBuilder to get the work_id value. But how can I pass the work_id value to the Select Layer by Attribute tool to use in the SQL expression?

I want something like work_location_id = %work_id%, but this one gives the "ERROR 00358: Invalid expression" error. What is the correct way to do this?

  • 1
    Try adding a sql variable (or called expression, cant remember) then pass Get Field Value to this and then use the expression as input to Select Layer... – BERA Dec 25 '18 at 8:30
  • @BERA Thank you. How to do that exactly? – PacmanKX Dec 25 '18 at 17:51
  • 1
    Is %work_id% a number or a string? You don't say. If a string then enclose in quotes. – Hornbydd Dec 25 '18 at 21:37
  • @Hornbydd It's a string, and yes, I forgot that. Thank you! – PacmanKX Dec 26 '18 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.