Is this possible with Model Builder in Pro?

984
9
02-14-2018 11:42 AM
ThomasColson
MVP Frequent Contributor

In model builder, I want to create some tools that manage the way we apply default schemas and metadata to our organizational data management workflow. For example, a tool that renames the project database from "My Project 99" to "Sasquatch Monitoring 2018". Or...adds a point feature class in the Project FGDB that contains a field labeled "Sasquatch_Number_of_Legs". That part is easy, but I want to take away the "What Geodatabase" to pick part of this, and have the Project Geodatabase, whatever it's name is, be the default input wherever a tool is asking for the project FGDB as an input....something like %ProjectGeodatabase%....does such a thing exist?

0 Kudos
9 Replies
DanPatterson_Retired
MVP Esteemed Contributor

That sounds like an 'Environment parameter'

Does your model have an default parameters set, like a scratch or default workspace?  much like you can set these things for your default project and when running the associated tools in ArcToolbox (it is the  'Environments' tab at the top of every tool)

DuncanHornby
MVP Frequent Contributor

I agree with Dan Patterson‌ this is an environment setting.

Environment settings are hierarchical so you set it at the model level and all tools that HONOUR  that setting will take it on automatically. Have a look at the help file here:

What is a geoprocessing environment setting?—Geoprocessing | ArcGIS Desktop 

ThomasColson
MVP Frequent Contributor

I'm familiar with the scratch and current workspace parameters...what I need to be able to do, is have a tool, let's say something as simple as "Create Feature Class" run against the default project geodatabase, without the user having to identify where or what that geodatabase is. Example, a user creates a new project in C:\GIS\USERNAME\SASQUATCH\2018, and the default geodatabase that is created when the project is created is named "MyProject2039.gdb", when the user opens the custom tool I've made, the only choice they have is what to name the feature class. The creation of the feature class will default to MyProject2039.gdb. Currently I'm not able to do that in Pro model builder with scratch or current.

0 Kudos
ThomasColson
MVP Frequent Contributor

Wait...I may be on to something...stand by...

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Every project has a default geodatabase... just use it

0 Kudos
ThomasColson
MVP Frequent Contributor

This illustrates my ignorance in model builder,  but...I figured out that %scratchGDB% will hit the "Project Geodatase" regardless of its name. In other words, your answer(s) were right.....

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Thomas... I often produce a scratch geodatabase within the Project folder structure, just for such purposes... junk... then when you want to archive the project, you delete the scratch gdb and your project gdb has all the necessary data files, void of clutter

LisaT
by
Occasional Contributor II

Hi Thomas, I see that you say you figured this out, but it isn't working for me.  I would like to publish a tool for my GIS Analysts to use on ANY project.  I have set my output name to: %scratchGDB%\myName.  When I run the tool I get an error that the featureclass cannot be created.  If I change the output to: myGDBname.gdb\myName the tool is successful.  I would like it to detect the geodatabase that is set to default in the project where I am running the tool, without having to manually go in and set it.  Is this possible?

0 Kudos
GrahamLake1
New Contributor II

Lisa, did you ever find an answer?  Currently trying to do the same thing.

Cheers G

0 Kudos