variable workspace

1067
9
Jump to solution
08-19-2013 08:30 AM
ShikoNjuno
Occasional Contributor
Hello all,
I have a model that works as it should and produces the right results. However, I need to allow the user to define their Workspace of choice (i.e. the folder on their computer) and send the model output results to that folder as shown below:
[ATTACH=CONFIG]26797[/ATTACH]
The problem is that the model does not work if the user does not explicitly change the output location shown as the parameters above.

To be clear....I created a workspace variable named "Workspace", exposed it as a parameter in my model and set it as a precondition for the rest of the model in order to force the user to define the workspace as an initial step.

I would like the user to only define the workspace and not have to manually select the output location of the results. I thought that the %Workspace%\Output\File_name would do the trick but still not happening.

Any suggestions?
0 Kudos
1 Solution

Accepted Solutions
AmyKlug
Occasional Contributor III
try looking at it's source properties. or the tool you create it with should say what type of output it creates. I'm pretty sure most tables created by ArcGIS tools must be stored in a geodabase but you can add in a table to table (tool) conversion to store them somewhere else (I think it works both ways????)

View solution in original post

0 Kudos
9 Replies
AmyKlug
Occasional Contributor III
Hello all,
I have a model that works as it should and produces the right results. However, I need to allow the user to define their Workspace of choice (i.e. the folder on their computer) and send the model output results to that folder as shown below:
[ATTACH=CONFIG]26797[/ATTACH]
The problem is that the model does not work if the user does not explicitly change the output location shown as the parameters above.

To be clear....I created a workspace variable named "Workspace", exposed it as a parameter in my model and set it as a precondition for the rest of the model in order to force the user to define the workspace as an initial step.

I would like the user to only define the workspace and not have to manually select the output location of the results. I thought that the %Workspace%\Output\File_name would do the trick but still not happening.

Any suggestions?


shouldn't the "outputs" folder be part of the workspace?
0 Kudos
ShikoNjuno
Occasional Contributor
shouldn't the "outputs" folder be part of the workspace?


That doesn't seem to be the problem.
What's also strange is that after running the model, the output locations reverts back to the default gdb which is entirely different from what is defined as the workspace.
I think it has to do with the fact that the tool I'm using, Select by Location, lets the user interactively select the area of interest on the map, which is saved to this default gdb?!!?!....really not sure why the model does this but every time I run it without defining the output location like I mentioned previously, I get the error message and the output parameter field  shows a gdb location.
0 Kudos
AmyKlug
Occasional Contributor III
That doesn't seem to be the problem.
What's also strange is that after running the model, the output locations reverts back to the default gdb which is entirely different from what is defined as the workspace.
I think it has to do with the fact that the tool I'm using, Select by Location, lets the user interactively select the area of interest on the map, which is saved to this default gdb?!!?!....really not sure why the model does this but every time I run it without defining the output location like I mentioned previously, I get the error message and the output parameter field  shows a gdb location.


What type of file are you trying to save to what type of output workspace?
0 Kudos
ShikoNjuno
Occasional Contributor
What type of file are you trying to save to what type of output workspace?


The output is two stand alone tables that are meant to be saved in the workspace of the user's choice.
Mine is my hardrive C:\ but I want it to be flexible enough to allow the user to run it from whatever drive and location they choose.
0 Kudos
AmyKlug
Occasional Contributor III
The output is two stand alone tables that are meant to be saved in the workspace of the user's choice.
Mine is my hardrive C:\ but I want it to be flexible enough to allow the user to run it from whatever drive and location they choose.


I did notice that your %workspace% shows up in the model interface. that should not happen. it should be in the tool (in the model) you are using to create the table.

EDIT: or was that only for display purposes? You might also want to make sure you can save that table extension to a geodatabase or a folder.
0 Kudos
ShikoNjuno
Occasional Contributor
Yes you are correct....that was only for display purposes.
I'm not sure what you mean by the table's extension though?
How would I accomplish what you are suggesting?
0 Kudos
AmyKlug
Occasional Contributor III
try looking at it's source properties. or the tool you create it with should say what type of output it creates. I'm pretty sure most tables created by ArcGIS tools must be stored in a geodabase but you can add in a table to table (tool) conversion to store them somewhere else (I think it works both ways????)
0 Kudos
ShikoNjuno
Occasional Contributor
try looking at it's source properties. or the tool you create it with should say what type of output it creates. I'm pretty sure most tables created by ArcGIS tools must be stored in a geodabase but you can add in a table to table (tool) conversion to store them somewhere else (I think it works both ways????)


Awesome Amy :D.....pure genius!!!!
That did EXACTLY what I needed to happen.
Thank you very much.
0 Kudos
AmyKlug
Occasional Contributor III
Glad that worked! 😄
0 Kudos