Add Locations Parameters - No Values

938
4
Jump to solution
09-18-2017 09:53 AM
RobertFord1
Occasional Contributor

Hello all,

I am attempting to create a model that would create a service area, add locations, and then solve. On the "Add Locations" tool I want the input locations, sub layer, and field mapping to be user supplied parameters. My problem is that when I make these parameters, the "Field Mappings" section remains blank and will not populate and look like the below 1st image. In my model, all columns remain blank no matter what I do (2nd picture). I have tried rearranging the parameters, removing then saving then re-adding them...etc. I have included a picture of my model as well.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
RobertFord1
Occasional Contributor

So I decided to just create a model by just putting in the "Add Locations" tool. I then made the following model parameters: Input Network Analysis Layer, Input Locations, Sub Layer, and Field Mappings. The problem is no longer there.

So after comparing this to my original model, I noticed that the difference was that in my original, the network analysis layer (Service Layer Name in my original) was not a model parameter. After making this a model parameter, I no longer have the issue. I have included screenshots below of Add Locations by itself, my model in model builder, and then the resulting model once run from a toolbox. So far it works! Thanks again!

View solution in original post

0 Kudos
4 Replies
MelindaMorang
Esri Regular Contributor

You need to specify a feature class for the Input Locations parameter before the field mapping control will populate.  The available field mappings depend on the fields available in the Input Locations, so it can't pre-populate with any specific values.

As long as Input Locations remains a model parameter, you are free to choose a different input feature class than the one you used to build the model, but you must use a dummy feature class to construct the model with the field mapping as you desire it.  Then, when you run the model, the input feature class must either have the same fields as your dummy feature class (to ensure that the field mapping works), or you must make the field mapping parameter a model parameter so you can change it at the time you run the model.

0 Kudos
RobertFord1
Occasional Contributor

Thanks Melinda!

I added a fire station layer, mapped a couple fields, and made the "field mapping" a model parameter. Within Model Builder, the field mapping section is now greyed out because it is a model parameter (screenshot below). However, when I run the model from my toolbox I still have the same issue. The "field mapping" box is still white like my second picture in the original post.

0 Kudos
MelindaMorang
Esri Regular Contributor

Possibly you can't both set a default in the model AND make it a model parameter.

0 Kudos
RobertFord1
Occasional Contributor

So I decided to just create a model by just putting in the "Add Locations" tool. I then made the following model parameters: Input Network Analysis Layer, Input Locations, Sub Layer, and Field Mappings. The problem is no longer there.

So after comparing this to my original model, I noticed that the difference was that in my original, the network analysis layer (Service Layer Name in my original) was not a model parameter. After making this a model parameter, I no longer have the issue. I have included screenshots below of Add Locations by itself, my model in model builder, and then the resulting model once run from a toolbox. So far it works! Thanks again!

0 Kudos