Jump to content

 
Photo

Copy values to Domain to mutilpule geodatabase

- - - - -

  • Please log in to reply
3 replies to this topic

#1
Robert2009

Robert2009

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 122 posts
  • Gender:Male
  • Location:Las Cruces, NM
  • United States

Is there a way around that I can copy code value to Domain to multiple geodatabases ? Right now I had to do it by one at a time.

Thanks,
Robert

#2
Ninomax

Ninomax

    Contributor

  • Validated Member
  • PipPip
  • 37 posts
  • Vietnam

Is there a way around that I can copy code value to Domain to multiple geodatabases ? Right now I had to do it by one at a time.

Thanks,
Robert

Just a quick thinking,
- prepare a table of code value domain in dbf format
- Put all Geodatabases into one folder
- use Python scripting with a loop function and TableToDomain tool
See a quick modified script from ArcGIS help below:

# Purpose: Update an attribute domain to constrain valid pipe material values



# Create the Geoprocessor object

import arcgisscripting

gp = arcgisscripting.create()



try:

	# Set the workspace (to avoid having to type in the full path to the data every time)

	gp.Workspace = r"C:\FolderOfGeodatabases"

	ListOfGeo = gp.listworkspaces("","Access")

	 for Geo in ListOfGeo:

		gp.TableToDomain("diameter.dbf", "code", "descript", Geo, "diameters", "Valid pipe diameters") 



except:

	# If an error occurred while running a tool, print the messages.

	print gp.GetMessages()


Hope this helps!

#3
Robert2009

Robert2009

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 122 posts
  • Gender:Male
  • Location:Las Cruces, NM
  • United States

Is this for personal or file geodatabase and yes i have them in one folder. How do I run this script in python ?


Thanks.

#4
Ninomax

Ninomax

    Contributor

  • Validated Member
  • PipPip
  • 37 posts
  • Vietnam

Is this for personal or file geodatabase and yes i have them in one folder. How do I run this script in python ?


Thanks.

"Access" means Personal Geodatabase. Basically, the script is correct but you have to modify some inputs such as name of table, code value.
ESRI writes help documents very well, you can check them for more details.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->