Select to view content in your preferred language

trying to set some parameters as optional in modelbuilder

6125
6
04-12-2010 05:53 AM
ToreBorvik
Occasional Contributor
Hi,

I have made a model where several parameters should be optional, but they are required and I cannot change it.

The attached screenshot shows two of the processes in the model. Process 1 is the only of all parameters I could set as optional. it is: single output map algebra (conditional statement) on an input raster

process 2, which can only be required; Less than Equal statement on a dtm, where the maximum elevation is a variable.

I have attached the screenshot of these two, the one I have as optional is marked with a black box while the one I can not set as optional is in a red box. I hope anyone has an idea.
0 Kudos
6 Replies
AlanToms
Regular Contributor
Model Properties > Parameters tab > Type

If it is possible for the parameter to be optional, you can change it there.

Alan
0 Kudos
ShitijMehta
Esri Regular Contributor
If the parameter you are trying to change to optional from Model properties are "Required" parameters of a tool that you are using in your model, you cannot change these parameters to optional.
0 Kudos
ToreBorvik
Occasional Contributor
Thanks for the replies.

I know how to set a parameter as either optional or required, if it can be either. But I do not understand why some of my parameters can ONLY be set as required. as in the attachment example: I have 5 rasters I do various stuff with, but they all end up as binary rasters (values 0 1). all those rasters get put in a single output map algebra expression

(raster 1 * raster 2 * raster 3 etc)

And I want 3 of the 5 inputs for the binary rasters to be optional parameters.. ideas how I can make them possible to be set as optional? I dont even know why one of them ended up as being able to be optional, even though it is a good thing it was
JacquieBow
New Contributor
In ArcGIS 9.3, if the input parameter is connected to a tool then it will automatically set it to required, without allowing you the choice to set it to optional.  Disconnect the input from the tool, go to Model Properties and it now has the choice to set that input parameter to optional or required. Perhaps they fixed this in ArcGIS 10?
0 Kudos
JackZHANG
Frequent Contributor
It's not fixed or possible in 10 or 10.1. not sure about 10.2....
Dislink the parameter to tool and set it to optional didn't work either.
0 Kudos
curtvprice
MVP Esteemed Contributor
I have made a model where several parameters should be optional, but they are required and I cannot change it.


This is really by tool - the validation within ModelBuilder checks against the validation code for every tool to see what is can be optional and what cannot.

You would get maximum flexibility if you created model variables (standalone, not connected to a tool) of type Raster Layer. The rasters you want to be required can be set up as preconditions to a Calculate Value tool.

Then, use the Calculate Value tool (write a python function code block) to generate an expression which you can then provide as input to the Single Output Map Algebra tool. Doing it this way may be a bit tricky, but will allow to do what you want.
0 Kudos