Join IN_MEMORY Table to FeatureClass

860
3
Jump to solution
10-04-2012 07:56 AM
JamesCrandall
MVP Frequent Contributor
ArcGIS 9.3.1
Python 2.5

I have a "IN_MEMORY" table verified by reviewing the gp.messaging:

newrows = gp.searchcursor("IN_MEMORY\TempDT") newrow = newrows.next() while newrow:   gp.AddMessage("Inserted: " + str(newrow.gis_station) + ", " +  str(newrow.station) + ", "  + str(newrow.sample_date)     newrow = newrows.next()


Now I'd like to join this with a FeatureClass in a PGDB.  I suppose that I will then have to issue a copyfeatures_management in order to see the result?  I really have no idea how else to see the joined FC in ArcMap.

Anyway, there is no error, but the output doesn't inlcude the joined fields either so any help is appreciated:

        tab = "IN_MEMORY\TempDT"     memtabname = "inmemtab"     gp.MakeTableView_management(tab, memtabname)     gp.AddJoin_management(memtabname, "gis_station", fc, "STATION", "KEEP_ALL")     gp.copyfeatures_management(fc, tempFC)
0 Kudos
1 Solution

Accepted Solutions
JamesCrandall
MVP Frequent Contributor
Not going to mark my own post as the answer, but should someone need to do this the solution is to use the TableView and FeatureLayer object instead of the objects themselves (from what I can tell anyway).

tab = "IN_MEMORY\TempDT" gp.MakeFeatureLayer_management (fc, "pointFC") ### convert the FC memtabname = "inmemtab" gp.MakeTableView_management("IN_MEMORY\TempDT", memtabname)  ### convert the in_memory table  gp.AddJoin_management("pointFC", "STATION", memtabname, "gis_station", "KEEP_ALL")     if gp.Exists(tmpLayer):    gp.Delete_management(tmpLayer)    gp.CopyFeatures_management("pointFC", tmpLayer)


(tmpLayer is a .shp file that I save to the user's local drive and tab was generated by filling a cursor from a cx_Oracle.connect call)

View solution in original post

0 Kudos
3 Replies
JamesCrandall
MVP Frequent Contributor
Not going to mark my own post as the answer, but should someone need to do this the solution is to use the TableView and FeatureLayer object instead of the objects themselves (from what I can tell anyway).

tab = "IN_MEMORY\TempDT" gp.MakeFeatureLayer_management (fc, "pointFC") ### convert the FC memtabname = "inmemtab" gp.MakeTableView_management("IN_MEMORY\TempDT", memtabname)  ### convert the in_memory table  gp.AddJoin_management("pointFC", "STATION", memtabname, "gis_station", "KEEP_ALL")     if gp.Exists(tmpLayer):    gp.Delete_management(tmpLayer)    gp.CopyFeatures_management("pointFC", tmpLayer)


(tmpLayer is a .shp file that I save to the user's local drive and tab was generated by filling a cursor from a cx_Oracle.connect call)
0 Kudos
KenBuja
MVP Esteemed Contributor
You should mark your own post as the answer. It makes it easier for someone looking for the correct answer to find your post. When doing a search, you're returned a list of threads, with the answered ones marked by a green "A". Wouldn't you look at those threads first?
0 Kudos
JamesCrandall
MVP Frequent Contributor
You should mark your own post as the answer. It makes it easier for someone looking for the correct answer to find your post. When doing a search, you're returned a list of threads, with the answered ones marked by a green "A". Wouldn't you look at those threads first?


Okay will do...  Done!
0 Kudos