Select to view content in your preferred language

ArcGIS Pro 3.0.2: How to make the “scratch workspace” environment as a parameter in the model?

2830
11
10-06-2022 09:34 AM
JamalNUMAN
Legendary Contributor

ArcGIS Pro 3.0.2: How to make the “scratch workspace” environment as a parameter in the model?

 

I couldn’t figure out how to make the “scratch workspace” environment as a parameter in the model

 

Clip_279.jpgClip_280.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
11 Replies
Robert_LeClair
Esri Esteemed Contributor

Jamal - if you hover a 1-2 seconds over any input parameters in the Gas Station Vector model/tool, you'll see the full GDB path.  It should be pointing to Default.gdb

JamalNUMAN
Legendary Contributor

My point here is that I need to make it as an option for the “end user”; the one who will be using the model without the need even to see its content. The end user needs to specify where to save the outputs based on his\her preferences. This means that the “scratch workspace” should appear in the main interface in order to browse to the required location

 

How this can be accomplished

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
Robert_LeClair
Esri Esteemed Contributor

So if I understand you correctly, you would like a user of the model to have a browse button at the end of each parameter so if they don't want the input/output to go to the scratch workspace that it goes (or comes from) somewhere else.  Correct?  If this is the case, then right-click on each tool and select create variable->from parameter.  Identify the parameter of interest.  Mark this as a model parameter.  When you save and open the model the scratch workspace of default.gdb is there but NOW there's a browse button for each parameter to allow the user to identify another geodatabase input/output.  Hope this makes sense.
ModelBuilder.JPG

JamalNUMAN
Legendary Contributor

I need the very end user to choose the “scratch workspace” for all the outputs exactly as we do with the environment tool AS PER THE SCREENSHOT BELOW

 

Clip_288.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
Robert_LeClair
Esri Esteemed Contributor

Okay - I understand what you're trying to do now.  I believe I'm getting closer to a solution for you.  In ModelBuilder, I went to the Insert group->Variable and chose "workspace" from the dropdown list.  Then I double clicked the new variable and entered %scratchGDB% and clicked OK.  Next I renamed the variable Scratch Workspace and marked it as parameter.  Saved the model and ran the model.  The result you can see below.

ModelBuilder2.JPG

0 Kudos
Robert_LeClair
Esri Esteemed Contributor

Related, in your graphic I saw are using the Feature Class to Feature Class GP tool, so another thought is to right-click the tool, select create variable->From Environment and choose "Current Workspace".  Then open the blue variable and in the input box, type %scratchGDB%, click OK.  Rename the variable Scratch Workspace.

ModelBuilder3.JPG

0 Kudos
JamalNUMAN
Legendary Contributor

 

I managed to implement the steps you have already provided. The outputs (green color) in the model appears not to respect the “scratch workspace” set in the “variable”.

 

Clip_310.jpgClip_311.jpgClip_312.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
Robert_LeClair
Esri Esteemed Contributor

Thx Jamal - yes, I too saw this after my initial post.  There is a second one after the first with a slightly different workflow that "might" work.  Have you tried that one too?  Still working on this...

JamalNUMAN
Legendary Contributor

Could you please elaborate a bit more regarding what you mean by “second one after the first with a slightly different workflow”?

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos