modelbuilder result won't add to TOC  (cont.)

12236
14
06-29-2010 05:47 AM
TomStephenson
New Contributor II
This is a continued thread from the old forum:
http://forums.esri.com/thread.asp?t=303855&f=1728&c=93

If you are having trouble getting your Model result added to the table of contents when running your tool from a toolbox, make sure you first have "Add results of geoprocessing operations to the display" ticked on, in the Geoprocessing tab of the File>Options dialog in ArcMap/Catalog. Secondly, you must also have "Add to display", "Model Parameter", AND the "Managed" option all ticked on when you right-click and select the options for your output in Model Builder.  This will hide the parameters from the user when run from the toolbox, but should still hopefully add to the display.

.... of course using the "managed" option restricts your output directory and name to teh default path of the input dataset.... gurrr.... back to square one :( anyone else?

Tom Stephenson
0 Kudos
14 Replies
AndrewChapkowski
Esri Regular Contributor
Hi Tom,

Can you post your model?  I would like to see what your model is doing so I can help figure out your problem.  Also please provide a list of output parameters you want added to the TOC and what version of ArcGIS you are using.



Thanks

A
0 Kudos
ToreBorvik
New Contributor III
My results add even though they are not set as managed. They still have to be both parameter and "add to display" though
0 Kudos
TomStephenson
New Contributor II
Hi Tom,

Can you post your model?  I would like to see what your model is doing so I can help figure out your problem.  Also please provide a list of output parameters you want added to the TOC and what version of ArcGIS you are using.



Thanks

A


I am trying to add the outputs of a simple model that copies a feature classes to a newly created FGDB. When the 'add to display' option is ticked on each output, the model will add the the result to the TOC, but only when run from within model builder, not from a toolbox.  I have attached the model
for you to investigate. I get the same result running ArcView 9.2 SP6, and 9.3.1 SP1.

Thanks for your help!

Tom
0 Kudos
AndrewChapkowski
Esri Regular Contributor
Tom,

You'll probably want to use python for this.  I've attached a script (untested) that might help.  I think what you are looking for is something that allows for users to just select an export directory and a file geodatabase name, but they do not have the option to change the output names.  That means you want to use a derived output parameter.  The parameters will still be modeled and the add to display selected, but the user will not have the option to enter in an output name.


A
0 Kudos
TomStephenson
New Contributor II
Thanks Andrew,

I'll have a look at your script but unfortunately this problem isn't specific to just this model. It's a problem I've had many times and judging by the forums I'm not the only one.

Cheers,
Tom
0 Kudos
DeeleshMandloi
Esri Contributor
Tom,
     
The "Add to Display" option is applicable ONLY when running your model from within Model builder. If you run your Model as model tool (i.e. from ArcToolbox or the Command window), then the model outputs are added to the TOC only if the model tool has one or more output parameters. Looking at your model, you should make all the parameters that you want to add to display as "Model Parameter". You have to also make sure that "Add results of the geoprocessing operations to display" within Tools > Options > Geoprocessing tab is checked on. More information is available here. Note that this help topic is from ArcGIS 10 help but this behavior has always been in place.
    
This logic of adding tool outputs to TOC is applicable to any geoprocessing tool whether it is a system tool or your own python script tool or model tool.

Hope this helps
Deelesh
TomStephenson
New Contributor II
Thank's for clearing that up Deelesh,
It's just a shame you cant add your results to the display withut having to expose your parameters to the users when running from a toolbox.

Regards,
Tom
0 Kudos
DeeleshMandloi
Esri Contributor
Tom,

If you don't want to expose the output parameters to the end users of your model, then you should make them as derived parameters. Derived parameters don't show up in the tool dialog when the model is run as a model tool and are also added to the TOC after the model is run.

However in model builder, it is not easy to convert an output parameter into a derived parameter. For example in your model, you are using the Copy tool which by definition has an output parameter. So in Model Builder if you make this as a Model Parameter, it becomes an output. In order to make this as derived output, you need to use a python script tool where by you have more control over what you can expose as a parameter and what are the properties of that parameter (such as derived, default values).

Hope this helps
Deelesh
0 Kudos
SusanRadke
New Contributor
I am also having problems adding a new shapefile created from a model using the FeatureClassToShapefile tool. I have modeled every output parameter I can, made sure the geoprocessing options are set to add results to the display, but no luck. I've attached the script if someone wants to take a look at it and let me know what I can do to accomplish this simple task!!! The script works to do everything else I need, except this.
Thanks,
slr
0 Kudos