Select to view content in your preferred language

scratchworkspace problem in modelbuilder

2315
1
04-12-2010 02:45 AM
ToreBorvik
Occasional Contributor
Hi.

I'm setting relative paths for geoprocessing results in a model. All data I make is set to %SCRATCHWORKSPACE%\name

I have set the scratchworkspace inside modelbuilder as a model-specific environment

However, the two final files which are the ones that are added to display, do not cooperate with the scratchworkspace I set in modelbuilder, instead they take the scratchworkspace I have set in the arcmap document.

Has anyone had any experience with this ?
0 Kudos
1 Reply
ShitijMehta
Esri Regular Contributor
To start: You can run a model by opening it in ModelBuilder or by from a model tool dialog by double clicking a model in Catalog. This opens the tool dialog like other gp tools , except for the fact that this is a model tool dialog.

Now about your problem:

If you are setting the scratchworkspace in two places: ModelBuilder and a default is set in ArcMap and run the model as a tool and not by opening the model in ModelBuilder this is what happens:
The environments of the application is called before the model starts to execute and the output is written to that scratch workspace.

If you want to write your output to the scratch workspace set inside the model run the model from ModelBuilder. A recommended practice is always to set the workspace environment at the application level to avoid this confusion.

If for some reason you want to set it in ModelBuilder try making a workspace variable and make this variable a model parameter. This way you have the control of the output workspace where your data should be written from the tool dialog. Use the name of the variable as in-line variable substitution %variable name% in your output path which is not a model parameter

or simply make the output a model parameter and define where you want it to be written from the model tool dialog.

Again recommended is to set the workspace at the application level.
0 Kudos