2

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?

enter image description here

1

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:

  1. I used the Iterate by Row. Iterate by feature iterates through different feature classes, I believe this isn't the case for you, based on the model you attached.
  2. I used Make feature layer instead of select by attributes. This subset only the selected features to a tmp layer, than it can be exported to a new output layer. This is important in particular when using tools like near, that write new fields into the input table, that is to prevent Null Values.

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: Example model 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): Make Feature Layer SQL Expression

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) Example for Result

  • The row selection suggestion is helpful! However,I only want distances to sales points that were sold by the corresponding dealer(which isn't always the closest one). THis is why I need to find a way to select sales made only by %dealer% before inputting to near tool. THis example that you made is great, but it looks like you have 4 sales, by 2 different dealers, In this case I only want to calculate the distance for the 2 sales sold by that dealer.*** – AmandaHD Mar 25 '15 at 23:26
  • If you have a dealer field in the sales layer so you can use the suggested model above. I already referred to this issue. If you dont have a dealer field so how can you relate sales to dealers? – dof1985 Mar 26 '15 at 8:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.