Script python

388
1
11-03-2013 04:39 PM
PierreWeisse
New Contributor
Hello,

I work on a place name entity class with a table containing a field "ABBREVIATION" and another field "FULL_NAME".

example

The "ABBREVIATION" contains                  'Ch.'
The fields "FULL_NAME" contains             'Church '

I will receive regular updates. In what way (python script), I know if new entries appear on my table update!

Look at the diagram attached.

Thanks
Tags (2)
0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor
Hello,

I work on a place name entity class with a table containing a field "ABBREVIATION" and another field "FULL_NAME".

example

The "ABBREVIATION" contains                  'Ch.'
The fields "FULL_NAME" contains             'Church '

I will receive regular updates. In what way (python script), I know if new entries appear on my table update!

Look at the diagram attached.

Thanks


Hi Pierre,

I guess the "Table Compare (Data Management)" could be an option for you. The link contains some Python snippets. Maybe it's better to use some python code to do this.

Jason Scheirer and Chris Snyder posted some nice examples a few days ago in this thread. If you combine their suggestions you end up with:

import arcpy
set_one = set(r[0] for r in arcpy.da.SearchCursor("Table1", "ABBREVIATION"))
set_two = set(r[0] for r in arcpy.da.SearchCursor("Table2", "ABBREVIATION"))
print "Set2 difference set1: {0}".format(set_two.difference(set_one))


This will print out:
Set2 difference set1: set([u'Mon.', u'Foot.'])

This set contains a list of the items in the second table which are not in the first table. What you need to know too, is that it will only check for the abbreviation and not the "full name". If the full name of an abbreviation has changed this code will not find it. To do that you will need to use dictionaries (which a collections of key, value pairs). Then loop through these and check both the abbreviation and full name.

Kind regards,

Xander
0 Kudos