Relative paths while saving output in model builder

1614
6
Jump to solution
07-22-2013 09:43 AM
ShikoNjuno
Occasional Contributor
Hi folks...
I have a working model which runs perfectly on my computer but when the model is open by someone else on their computer, we encounter workspace issues with the output.
The model currently incorporates the Zonal Statistics as a Table tool, where the output is saved to my hard drive. How can I change the settings so that the model will automatically know what drive to save output in regardless of the user computer.
See output path below:
C:\Work\Selection_Results
In other words, is there a way to ensure that output will go into the folder Selection_Results no matter where the entire folder is saved i.e. USB Drive, External Hard Drive etc???
I hope this isn't too confusing, I just simply want model builder to know where to read input from and save output to, without having to reset the paths in edit mode on another computer.

Note: "Store relative path names (instead of absolute)" is checked in the model properties.
0 Kudos
1 Solution

Accepted Solutions
ChristopherBlinn1
Regular Contributor
Shiko,

Here's something I do for all of my tools I create for other users.

Create Workspace variable, make it a parameter, and have users navigate to the Selection_Results folder on their system before running the tool.  You can then make it a precondition before running the Zonal Statistics as a Table tool.

By default, the workspace variable will be called "Workspace", and for the output table you would simply replace "C:\Work\Selection_Results" with %Workspace%.  Your output table variable will then look like:  %Workspace%\OutputTable .  Note, if you change the variable name from "Workspace" simply call the new variable name between percentage signs.

If Selection_Results folder does not exist on someone's system, the tool will still output the table into whatever workspace the user chooses.

Hope this helps!

Chris B.

View solution in original post

6 Replies
ChristopherBlinn1
Regular Contributor
Shiko,

Here's something I do for all of my tools I create for other users.

Create Workspace variable, make it a parameter, and have users navigate to the Selection_Results folder on their system before running the tool.  You can then make it a precondition before running the Zonal Statistics as a Table tool.

By default, the workspace variable will be called "Workspace", and for the output table you would simply replace "C:\Work\Selection_Results" with %Workspace%.  Your output table variable will then look like:  %Workspace%\OutputTable .  Note, if you change the variable name from "Workspace" simply call the new variable name between percentage signs.

If Selection_Results folder does not exist on someone's system, the tool will still output the table into whatever workspace the user chooses.

Hope this helps!

Chris B.

View solution in original post

JimCousins
MVP Regular Contributor
How about simply making the workspace a parameter of the model, so it gets set before running?
Regards,
jim
0 Kudos
ShikoNjuno
Occasional Contributor
Thanks Chris....and Jim....You both had the same idea, which I will try right away.
Cheers to you both 🙂
0 Kudos
ShikoNjuno
Occasional Contributor
Shiko,

Here's something I do for all of my tools I create for other users.

Create Workspace variable, make it a parameter, and have users navigate to the Selection_Results folder on their system before running the tool.  You can then make it a precondition before running the Zonal Statistics as a Table tool.

By default, the workspace variable will be called "Workspace", and for the output table you would simply replace "C:\Work\Selection_Results" with %Workspace%.  Your output table variable will then look like:  %Workspace%\OutputTable .  Note, if you change the variable name from "Workspace" simply call the new variable name between percentage signs.

If Selection_Results folder does not exist on someone's system, the tool will still output the table into whatever workspace the user chooses.

Hope this helps!

Chris B.


Hi Chris,
I was hoping you could help me out with this one since I got the idea from you.
The %Workspace%\WhateverFolderName method is not quite working as I was hoping. I thought that the user would only have to define the workspace once and not have to tamper with the output location.
What's happening if I don't explicitly select the location of my model outputs is that I get the following error message:

ERROR 000875: Output table: C:\Work\A_Klamath_Presentation\Presentation7252013.gdb\Outputs\crops's workspace is an invalid output workspace.
ERROR 000581: Invalid parameters.
Failed to execute (Zonal Statistics as Table).

Because the Zonal Statistics output was not navigated to. The only way the model works is if I navigate to both the workspace and output locations. I'm I doing something wrong or do I not have the correct settings on?

Thanx.
0 Kudos
AlisonSchilling
New Contributor III
for my current model I have several "Workspace" parameters, this was because we needed to save our intermediate files, so we specified them with a workspace parameter named differently. Try setting more then one "workspace" parameter. Our output files have a parameter called "Output Location" and our intermediate files have one called "Temporary Files" ect... don't forget the %Temporary Files%\reclass1 ect.
0 Kudos
ShikoNjuno
Occasional Contributor
for my current model I have several "Workspace" parameters, this was because we needed to save our intermediate files, so we specified them with a workspace parameter named differently. Try setting more then one "workspace" parameter. Our output files have a parameter called "Output Location" and our intermediate files have one called "Temporary Files" ect... don't forget the %Temporary Files%\reclass1 ect.


Thanks but I actually found a solution that allows me to have just one Workspace variable.
See thread below:

http://forums.arcgis.com/threads/90812-variable-workspace

Thanks for the suggestion anyway, I'll keep it in mind for next time I run into something similar.
0 Kudos