RachWilliams

Comparing values in an Access table with filenames of existing GDB's

Discussion created by RachWilliams on Feb 18, 2011
Latest reply on Feb 18, 2011 by Dan_Patterson
I am trying to use a lookup table to compare a list of facilities that need geodatabases with the geodatabases that already exist in order to generate a list of geodatabases that need to be created. My script is stopping after the first record in the table and does not continue to search through any subsequent records. Here is what I have so far:


lookuptbl = r"P:\\USACE Mobile 0610-01 2010 63D RSC NR Contract\\03-Source Documents\\GIS\\SITE_ID_LOOKUP.mdb\\new_facility"
q = '[include_in_gis] = ' + "'" + "X" + "'"
#prnt q
#IF q is satisfied, the gdb that is currently being processed was found in lookup table;
#If q is NOT satisfied, the script will skip the gdb alltogether; nothing will be done


rows = gp.SearchCursor(lookuptbl, q)
row = rows.next()

while row:
    facil_id = row.GetValue("facil_id")
    print facil_id
    lookuptbl2 = r"P:\\USACE Mobile 0610-01 2010 63D RSC NR Contract\\03-Source Documents\\GIS\\SITE_ID_LOOKUP.mdb\\gdbs"
    q2 = '[facil_id_in_gdbs] = ' + "'" + facil_id + "'"
    #prnt q
    #IF q is satisfied, the gdb that is currently being processed was found in lookup table;
    #If q is NOT satisfied, the script will skip the gdb alltogether; nothing will be done
   
    rows = gp.SearchCursor(lookuptbl2, q2)
    row = rows.next()
    
    while row:
        print facil_id + "--already exists"
        row = rows.next()
    
        
    row = rows.next()        


I am new to writing scripts so any help you could give me would be much appreciated.

Outcomes