Select to view content in your preferred language

Create File GDB and store as variable

2621
10
Jump to solution
03-28-2019 07:17 AM
RyanF
by
New Contributor

I'm working on a script that originally had locations coded in but I want to make it where anyone in my office can use it and they can set their workspace up however they want. I've almost got it to work how I want. I think I have one more obstacle then I'm good.

I have some parameters set up for user input.

arcpy.env.workspace = arcpy.GetParameterAsText(0)

FileGDB_name = arcpy.GetParameterAsText(1)

NewLocation = arcpy.CreateFileGDB_management(arcpy.env.workspace, FildGDB_Name)

clipLayer = arcpy.Clip_analysis(RouteLayer, StateLayer, NewLocation + name + "Clip")

RouteLayer and StateLayer are additional parameters set up by the user. The script fails when it gets to the clip tool. I realize the way I have it set up, NewLocation calls the CreateFileGDB tool rather than the location of the GDB. I want to be able to create the GDB and store it as a variable so it can be used in other tools in the script. Could someone shed some light on how to do this?

Thanks!

0 Kudos
10 Replies
JoshuaBixby
MVP Esteemed Contributor

Please mark someone's answer correct to close out the question.  Thanks.

0 Kudos