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?

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

modelbuilder result won't add to TOC

Displaying model data

Tutorial: Creating tools with ModelBuilder

Thread: Model builder won't add output of process

A quick tour of creating tools with ModelBuilder

Creating model parameters

Tutorial: Executing tools in ModelBuilder