Hi everyone,Here is my daily python question just to keep you all on your toes...I would like to add a field called "LCArea" and calculate, you guessed it, the area.But I don't know what to put in the codeblock because I can only find area calculation codes in VBA.I would appreciate some guidance as to how to use the expression and codeblock parameters.Thanks.And as a side note, when using the Advanced Field Calculator in ArcMap, it defaults to VBA. How do I do field calculations using python in ArcMap?Thanks!# If the output is a geodatabase feature class...
if outType == "FeatureClass":
# Then export the attribute table
gp.MakeTableView_management(dissolveOutputFC, tableView, "", "", "UCID Catchment VISIBLE; GRIDCODE LandCov VISIBLE; Shape_Area LCArea VISIBLE")
gp.TableToDbase_conversion (tableView, tableFolder)
# If the output is a shapefile...
elif outType == "ShapeFile":
# Then add and calculate an area field...
gp.MakeTableView_management(dissolveOutputFC, tableView, "", "", "UCID Catchment VISIBLE; GRIDCODE LandCov VISIBLE")
gp.AddField_management (tableView, "LCArea", "DOUBLE", "", "", "", "", "", "", "")
expression =
codeblock =
gp.CalculateField_management (tableView, "LCArea", expression, "PYTHON_9.3", codeblock)
gp.TableToDbase_conversion (tableView, tableFolder)
# And export the attribute table
#else:
# Error handler to exit the script and return some message
#print 'done'