I have two processes in model builder:
- Iterate over a "ID_SPATIAL" field values = creating a subset of original feature class (and agregating using Frequency tool)
- Creating a different subset using a "Code" field from the original feature class by SQL query
What I need is to use the values from "Code" field within the first subset as an input to SQL query. Model looks like this:
My SQL query could look like this:
SELECT * FROM INPUT2 WHERE Code IN (SELECT Code FROM %ID_freq list%)
I have spent last day wondering about this problem. How can I transfer values from field of another process into SQL query?
I don't have a solution yet... but I succeded to make a procedure using a submodels with Merge tool and Collect Values tool of model builder. This is very programming nasty, but since I haven't found a solution it helped. THe problem is, that this is very very time consuming procedure, and I have to run it over and over again after an hour when ArcMap depletes its inner memory.
Submodel: for each ID_SPATIAL this iterates "Code" field and back query the data (A02_108_not_null_codes) "Code" field for each one. Afterwards, it passes selected features to Merge tool (overall model).