Select to view content in your preferred language

How can you pass a variable to a SQL Expression for a Select by Attribute in Modelbuilder

740
1
Jump to solution
09-28-2023 04:23 PM
JohnDavidson
New Contributor III

Working to create a script which iterates over a set of CSV files and then joins to a ZIP file. One that is completed, it goes through to Select by Attribute to ensure we are looking only true values and not null.

JohnDavidson_0-1695943002754.png

I have the model written and it works well on the first pass, but when it comes to the next file it fails because the Select Layer by Attribute is looking for the previous filename. How can I pass the filename as a variable? Is this possible?

I have referenced the below article without any luck in having it work either.

https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/modelbuilder/inline-variable-su...

Any help to get this working would be greatly appreciated.

0 Kudos
1 Solution

Accepted Solutions
JohnDavidson
New Contributor III

I am not sure why I didn't think of this sooner. So I was able to get the %Variable% working as it should, but then I couldn't get the second half working such as '.csv.REV_SUB_TOTAL'

I added it as its own Variable called %String% and then changed my SQL statement to %Name%%String% IS NOT NULL and it worked!

View solution in original post

0 Kudos
1 Reply
JohnDavidson
New Contributor III

I am not sure why I didn't think of this sooner. So I was able to get the %Variable% working as it should, but then I couldn't get the second half working such as '.csv.REV_SUB_TOTAL'

I added it as its own Variable called %String% and then changed my SQL statement to %Name%%String% IS NOT NULL and it worked!

0 Kudos