Using Parameters in Model causes Error; Solutions or Alternatives?

4657
11
07-23-2014 06:23 AM
StefanieSteinbach
New Contributor III

Dear all,

 

I have set up a workflow in model builder, with several variables set as parameters.

Thus, for example the cell size of my initial raster (a parameter) is used for further calculations in SQL commands. Executing the model with the actual cell size put into the calculations manually by me works fine, whereas using "%CellSize%" produces an error.

Did anyone encounter a similar problem or has an idea for a solution? For the sake of user-friendliness it is vital that the variables function as parameters.

 

Thanks in advance.

0 Kudos
11 Replies
AdamMarinelli
Occasional Contributor

Can you post a screenshot or more details about your model? What is the error you are getting?

0 Kudos
StefanieSteinbach
New Contributor III

Yes sure, these are what's in the command (cost grid) and the error. Tell me if you need more information.Cost grid.PNGCost grid2.PNG

0 Kudos
JohannesBierer
Occasional Contributor III

This looks quite complicated, wouldn't it be a idea to export your model into python code.

In my opinion you would have better control about your variables ... ?

0 Kudos
StefanieSteinbach
New Contributor III

The model itself is also quite complicated, so I find the better overview provided by model builder advantageous. Also, I am not too familiar with python coding.

And if it is not a bug in model builder, there should be a way to get this to work shouldn't it? I'm just running out of ideas

0 Kudos
AdamMarinelli
Occasional Contributor

How are you actually pulling out the CellSize from your initial raster?

0 Kudos
StefanieSteinbach
New Contributor III

It's just a 'cell size' variable with the input being the DEM. I am then using it as I would use an 'any value' variable. Same with the "%ElevationDifference%".

0 Kudos
AdamMarinelli
Occasional Contributor

Try removing the quotations from around %Cell Size% as it is a number and not a string.

0 Kudos
StefanieSteinbach
New Contributor III

Hm, it tried, but now it says it is an invalid SQL statement

0 Kudos
AdamMarinelli
Occasional Contributor

Is the "invalid SQL statement" error occurring on the Raster Calculator or somewhere else in the model?

0 Kudos