how to compare value fields in different shapes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • flormarinkovic
    New Member
    • May 2010
    • 2

    #1

    how to compare value fields in different shapes

    Good morning,

    I have resume my old question for the follow:

    I have shapes in different folders, and i need to check if the field "Codi_bd" and then i have to compare the value of the fields of this shapes with the value fields that should be, according to the oficial list of values that each shape should have.

    I have already got the value fields for one shape in one folder, but now i need to do it for all the rest shapes in each folder automatically.

    Thanks for any help!!!
    Code:
    #to check if field  "codi_BD" exists
    fcCampNE=[]
    f.write('\nChecking the shape escarpaments.shp :\n\n')
    for fc in fcExisteix:
    registres = []
    llista =[]
    fields = gp.ListFields(fc)
    #fields = gp.ListFields('escarpaments_7721.shp')
    
    for field in fields:
    
    if str(field.Name) == 'Codi_BD':
    cur = gp.SearchCursor (fc)
    row = cur.Next()
    nn = 0
    while row <> None:
    llista.append(row.Codi_BD)
    row = cur.Next()
    
    for item in list:
    #Here we will create a new list eliminating duplicates
    
    if item <>' ':
    if item not in registres:
    registres.append(item)
    for valor_camp in registres:
    treure = '_' + numfull + '.shp'
    llistaValor = fc.lstrip(treure)
    print llistaValor
    for valorFila in llistaValor:
    correcte = 0
    if str(valor_camp) == str(valorFila):
    correcte = 1
    if correcte == 0:
    # f.write(outFeatureClass+'-'+valor_camp + '......... existeix\n')
    #else:
    fcCampNE.append(valor_camp)
    nn = nn + 1
    
    
    for camp in fcCampNE:
    print camp
    f.write('\n'+ camp)
    
    #f.write("\nHi ha " + str(nn) + " registres erronis.\n")
    f.write('\nComprobats tots els fitxers')
    f.close()
    Last edited by Frinavale; May 13 '10, 02:32 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags for legibility.
  • Glenton
    Recognized Expert Contributor
    • Nov 2008
    • 391

    #2
    Hi

    Please edit your post to include code tags. It's very hard to follow without the indentation.

    Thanks

    Comment

    Working...