sssobel

Feature Class Not Added to Display / Table of Contents When a Variable Name is Used

Discussion created by sssobel on Mar 8, 2013
Latest reply on Aug 1, 2014 by surendrankn
I have a relatively complex model, where I would like to allow the user to input a Scenario Name as a parameter and have the model use that parameter to name the output feature classes appropriately. For example: Scenario1_Points; Scenario1_Lines; Scenario1_Polygons, etc. They would then be able to run the model a second time and create new outputs while the previous outputs do not get overwritten.

To do this, I have a string parameter, and when the output FC name is specified, it is C:\Tools\Model\Model_Output.gdb\%ScenarioName%_Points

This method works perfectly when the model is run within the Edit mode of ModelBuilder. However, when the model is saved and run as a tool, the layer is created, with the correct name, but the layer is not added to the map.

The model is being run from within ArcMap, not ArcCatalog. I have the Scenario Name input marked as a parameter and the output FC is marked as a parameter. Under the Geoprocessing menu, Display/Temporary Data, the "Add results of geoprocessing operations to the display" is checked. I have somewhat exhaustively searched the forums and Google, but can't find mention of variable names preventing data from being added to the table of contents.

I can confirm that the variable name is the issue, because when I remove the variable and hard code the FC name, the FC is added to the map correctly, even when the model is run as a tool. I have attached a toolbox with two very simple tools to demonstrate the issue. They are identical, except that one of them has a user input parameter, which is used to name the output. The other one has a hard-coded output name. They place the output in a GDB at C:\Tools\Bug_Test\Model_Output.gdb.

I am running ArcGIS Desktop 10 Service Pack 5 (Build 4400), ArcInfo license.

Similar threads that have not helped:
Thread: Modelbuilder as a tool is not the same as running the same model in modelbuilder?
http://forums.arcgis.com/threads/48066-Modelbuilder-as-a-tool-is-not-the-same-as-running-the-same-model-in-modelbuilder?highlight=variable+output+display

Thread: modelbuilder result won't add to TOC (cont.)
http://forums.arcgis.com/threads/7255-modelbuilder-result-won-t-add-to-TOC-%28cont.%29

modelbuilder result won't add to TOC
http://forums.esri.com/thread.asp?t=303855&f=1728&c=93

Displaying model data
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Displaying_model_data/002w0000003q000000/

Tutorial: Creating tools with ModelBuilder
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w0000007v000000

Thread: Model builder won't add output of process
http://forums.arcgis.com/threads/41125-Model-builder-won-t-add-output-of-process?highlight=variable+output+display

A quick tour of creating tools with ModelBuilder
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/A_quick_tour_of_creating_tools_with_ModelBuilder/002w0000007m000000/

Creating model parameters
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Creating_model_parameters/002w0000003z000000/

Tutorial: Executing tools in ModelBuilder
http://resources.arcgis.com/en/help/main/10.1/index.html#//00210000003v000000

Outcomes