Generalizing Model to Work with any Source and Target Layer

Discussion created by gmtrucks on Mar 5, 2013

I do a lot of proximity analysis using "select by location" and would like to cut down on the effort spent each time doing this! I have put together a model using model builder that iterates over features in a feature layer (source layer), selects features in a separate target layer based on the set parameters, and then uses summary statistics to summarize over a certain field. Where I'm getting caught up is in making this as general/customizable as possible. I've attached a screen shot of my model thus far. I have two issues I'm running into:

1) I've set the "statistics field" of the Summary Statistics tool as a model parameter. However, when I go to run this model through ArcToolbox, I set the target layer right after the source layer, but the statistics field isn't then populated with the list of potential fields from the target layer. The drop down menu remains blank. Is there a way to make all the target layer fields populate similarly to how they would if you were using the Summary Statistics tool alone and set an input layer?
2) Get Field Value gets the value of the first row of the specified field, but I do not know how to tell it to get the value of the field of what I just summarized on. So, in Summary Statistics, if I told it to get the SUM of a field called POPTOTAL, then I want the Get Field Value tool to grab the value from the new field called "SUM_POPTOT" in the output statistics. There should only be one row of data, so I don't need to worry about getting the correct row. I have "Field" set as a model parameter currently, but I don't think it needs to be.

Any help would be much appreciated! I'm using ArcMap 10.1. I'm still new to model builder...I have some background in programming, so Python script would be fine (or maybe even better).