Select to view content in your preferred language

How to calculate a value and use the result as a variable and perform an equation...

757
1
05-12-2010 12:16 PM
scottstreisel
New Contributor
on multiple inputs and rasters.

I am trying to build a model and I have two problems. 1- I need to have to user input variables calculated and the result used as a variable in a simple multiply tool. Currently the only way I can get it to work is manually do the addition and put the number in the input raster or constant value1 field of the tool.


2- I need to have a user input 8 different values and use them in an equation that multiplies them by different rasters. Also they if possible should have a default value in the variable.

The equation goes something like this ((UserVar1 + UserVar2) * Raster1) + ((UserVar3 + UserVar4) * Raster2)..........
The UserVar 1 - User Var 8 are different types of numbers for example userVar1s default = -4.874733 and UserVar4s default = 6.069E-07


Any suggestions? I am fairly new to the model building and have little to no scripting knowledge at this point.
0 Kudos
1 Reply
ShitijMehta
Esri Regular Contributor
If you are new to ModelBuilder I would strongly suggest reading the online help for it.
if you are using 9.3 or 9.3.1
http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Creating_a_simple_model


If you are using 10 prerelease
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/What_is_ModelBuilder/002w0000000100000...


You need two things:
1) Model Parameter which lets the user input values from model tool dialog.
To create a model parameter:
In MB create variables (8 if you want 😎 and select them, right click and check Make Model Parameter. A letter P appears besides the variable indicating that it is now a model parameter. Now when you double click a model from Catalog window the model will open with a dialog and you will see the variables as input parameters, in the order you made them model parameters.

You will have to read a bit to understand more about changing model parameter order and data types of the variable in the model. I suggest you read the help from this link.
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Creating_stand_alone_variables/002w000...
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Creating_model_parameters/002w0000003z...


2) Next to use the variables/ user input model parameter values you can use the variable in the model as in-line variable substitution. You might have to read some help for the first time.
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Examples_of_inline_model_variable_subs...


See the attached image  to understand a small example of how to use in-line variable substitution.

Hope this helps.
0 Kudos