System ArcGIS 9.3Problem: copy values in multiple fields to one added field.I have a polygon shapefile.Its attribute table has five fields, including C0011, C0012, C0013, C0014, and C0032.Each field has two rows, S and W.S or W represent multiple polygons. In total there are ten rows in the attribute table.No rows are overlapped between fields. Now I want to add a field called ???sum??? and copy the values from C0011 to C0032 to this field.I generated the code below.However, the line of query seems wrong syntax.Please kindly advise how to describe wild card for field of C0011, C0013, and C0032.Thanks.##Script Name: calculate sum
##Description: calculate sum
##Created By: Elaine Kuo
##Date: 26/05/2012
#Import standard library modules
import arcgisscripting
import os
#Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
#Set the workspace.
gp.Workspace= "H:/temp/test"
#gp.Workspace= "H:/temp_stage_2_3_polygon_limit_1984_no_R_O/P_Turdidae_22"
#Set the workspace. List all of the feature classes in the dataset
outWorkspace= "H:/temp"
#outWorkspace= "H:/temp_stage_2_3_polygon_limit_1984_no_R_O"
#Get a list of the featureclasses in the input folder
fcs = gp.ListFeatureClasses()
# Create a value table that will hold all of the input features to Merge.
vt = gp.createobject("ValueTable")
# Loop through every item in the list that was just generated
for fc in fcs:
# Break out the name, no path or extension, using the describe object.
desc = gp.describe(fc)
featureName = desc.name
# Add a field to this shapefile, of type LONG
gp.AddField (fc, "All", "Text", 6,6)
# Populate the input value table with feature classes.
vt.AddRow(fc)
# Get a list of the fields in the featureclass
fields = gp.ListFields(fc, "C*", "String")
# Loop through every item in the list that was just generated
for field in fields:
gp.toolbox = "Data Management"
gp.addMessage(type(field))
# Select records to be deleted (C*, i.e. C7658)
# Make temporary featureclasses
gp.Select_analysis(fc,("output.shp"))
# copy values in existing fields to the new field
query = "\"%s\" = 'C*'" % field.Name
gp.CalculateField_management("output.shp", "All", query,"PYTHON_9.3")
#Validate the new feature class name for the output workspace.
OutFeatureClass = outWorkspace + os.sep + gp.ValidateTableName(fc,outWorkspace)
# clear memory of temporary shapefiles
gp.Delete("output.shp")
gp.AddMessage(gp.GetMessages())
print gp.GetMessages()