2

I am trying to write a piece of code to populate an Access mdb table with information from text elements in an mxd (text elements all have "names"). The purpose of this is to create a catalog of my mxd's and what they hold without having to manually open up every mxd. Note that the "names" of the text elements are all the same in every mxd. So what I will end up with is a script which grabs the text from a text element and inserts it into the Access table in a specific place. The Access table will be 1 record per mxd.

The version of ArcGIS I am using is 10.2.2.

Note that I am relativity new to python so I do apologize if I have not explained this well and will happily clarify anything.

  • I don't know how easy it is to open and insert rows into an access table but you could write to a csv file then import that into access. I had done something similar in the past. – Hornbydd Sep 17 '14 at 13:29
  • 1
    Writing to an access database can be done easily if you use it as a normal personal geodatabase and create a new table for your output. If you do not want all of the overhead of the GeoDB tables Arc will create, you can use a 3rd party database object in your python script such as pydobc to make the connections. – Lemur Sep 17 '14 at 14:20
0

To do what you describe will be a multi-part process so I recommend that you start by writing a few scripts that just do a single component, and then look later at how to combine their logic.

For example:

  • Try writing a script that just prints out the name of every MXD on your file system (or from one particular folder and all of its subfolders) - I would use arcpy.da.Walk to do this.
  • Try writing a script that just prints out the name and content of every text element in a single MXD - I would use arcpy.mapping.ListLayoutElements to do this.
  • Try writing a script to write some test rows to an Access database - @Lemur has offered ideas for doing this as a comment on your question
  • Champion response. I am just starting to use python in work and studies and going through those stages will help me a lot. – jiphoc Sep 21 '14 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.