Hi all! How can I get the fields iterator to work for my model. My model has to iterate though 58 fields in the attribute table of the layer I'm working on. For each field It has to return the total number of 0s. So far it has only done it for the first field. I have tried to use inline variable substitution - SQL expression where %Value% = 0 but it returns syntax error, so the iterator doesn't work. The fields in my attribute table are various data types. If I ignore the field iterator the model works fine but obviously for the chosen field only. There is very little information on the use of Iterate fields option on the internet so I have mainly used these two sources: https://pro.arcgis.com/en/pro-app/latest/tool-reference/modelbuilder-toolbox/iterate-fields.htm and https://pro.arcgis.com/en/pro-app/latest/tool-reference/modelbuilder-toolbox/examples-of-using-itera...
Solved! Go to Solution.
I think you're nearly there - I tried to recreate what you're doing and here's the changes I made:
1. First of all, ensure you've limited the Iterate Fields to only use numeric field types (it will fail trying to evaluate Value = 0 if it's a text field). If you only have numeric data in your table, then this won't be an issue.
2. Insert a String variable and enter your expression using the %Value% in-line variable there. Feed this into the Table Select as the Expression, and that should be job done.
I think you're nearly there - I tried to recreate what you're doing and here's the changes I made:
1. First of all, ensure you've limited the Iterate Fields to only use numeric field types (it will fail trying to evaluate Value = 0 if it's a text field). If you only have numeric data in your table, then this won't be an issue.
2. Insert a String variable and enter your expression using the %Value% in-line variable there. Feed this into the Table Select as the Expression, and that should be job done.
Thank you so so very much! I can see the logic in that one. I'll give it a try and post how I got on later today/tomorrow, and mark the question as resolved 🙂