I am using Iterate feature selection to select dealers one by one as input features to the Near tool. I'm using Select by Attributes to select sales points from that same dealer. How do I sync the Select by Attribute (dlr_no=%value%) with the current feature selection that is being selected by the iterator?
[GIS] Using a feature iterator Value variable in a SQL expression of select by attribute
arcgis-desktoparcmapiteratormodelbuildersql
Best Answer
I suggest few modification to your model and it should work, but in general you are on the right way.
My data (hopefully as yours) include: Dealers point feature class and Sales point feature class. Each sale row has a dealer ID which relates the sale to its dealer.
My modifications are:
However, my model outputs many output, actually as much outputs as dealers in the input dealer layer. Thus merge can create one output layer from all (either using the suggested model as a nested model within an input and merge model, or trying writing in the input table, hopefuly it won't cause troubles).
The model provided in the image below: I used copy feature to export the tmp layer, and used the %Value% variable within the output name string to mark it by the dealer ID.
The syntax of the SQL expression is showed in the image below (Make Feature Layer tool):
The result (an example for one of my two sales with distance from dealers outputs are shown below (note that the input layer: Sales is not being displayed and that the coordinates system is WGS 84, thus near distance is using DD)