Solved! Go to Solution.
import arcpy # don't import modules if you're not gonna use them sys, string, os # Get the input from the model InputTable = arcpy.GetParameterAsText(0) InputArea = arcpy.GetParameterAsText(1) InputDepth = arcpy.GetParameterAsText(2) Newfield = "Volume" #Add Field arcpy.AddField_management(InputTable, Newfield, "DOUBLE", "", "","", "Vol","NON_NULLABLE","NON_REQUIRED","") #Calculate Field # field names should be wrapped in exclamation marks, function uses string #representation of expression, not real python expression Expression = '!%s! * !%s!' % (InputArea.upper(), InputDepth.upper()) # 'PYTHON' not 'Python' arcpy.CalculateField_management(InputTable, Newfield, Expression, "PYTHON")
import arcpy # don't import modules if you're not gonna use them sys, string, os # Get the input from the model InputTable = arcpy.GetParameterAsText(0) InputArea = arcpy.GetParameterAsText(1) InputDepth = arcpy.GetParameterAsText(2) Newfield = "Volume" #Add Field arcpy.AddField_management(InputTable, Newfield, "DOUBLE", "", "","", "Vol","NON_NULLABLE","NON_REQUIRED","") #Calculate Field # field names should be wrapped in exclamation marks, function uses string #representation of expression, not real python expression Expression = '!%s! * !%s!' % (InputArea.upper(), InputDepth.upper()) # 'PYTHON' not 'Python' arcpy.CalculateField_management(InputTable, Newfield, Expression, "PYTHON")