I keep getting the following error:
Traceback (most recent call last): File "R:\GIS_ScriptsandTools\PullHotParametersLabel.py", line 16, in TitleLine = ""+row.getValue(IDfield)+" ("+ row.getValue(Datefield)+") "
AttributeError: 'list' object has no attribute 'getValue'
When I am trying to run a typical for row in cursor loop when working with an UpdateCursor. For the life of me, I can't figure out why it thinks the row is a list and not a row object. Here is my script:
import arcpy
SourceTable = arcpy.GetParameterAsText(0)
IDfield = arcpy.GetParameterAsText(1)
Datefield =arcpy.GetParameterAsText(2)
SelectedParams = arcpy.GetParameterAsText(3)
OutputField = arcpy.GetParameterAsText(4)
SelectedFields = SelectedParams.split(';')
AllFields = arcpy.ListFields(SourceTable)
FieldDict = {}
for field in AllFields:
FieldDict[field.name]=field.aliasName
with arcpy.da.UpdateCursor(SourceTable,"*") as cursor:
for row in cursor:
TitleLine = "<und><bol>"+row.getValue(IDfield)+" </bol>("+ row.getValue(Datefield)+")</und>"
LabelList = [TitleLine]
for Field in SelectedFields:
if row.getvalue(Field) <>0:
Alias = FieldDict.get(Field)
ParamValue = row.getValue(Field)
ParamLine = '{0} = {1:,}'.format(Alias,ParamValue)
LabelList.append(ParamLine)
if len(LabelList)<2:
LabelList.append("All < 2L")
Label = '\n'.join(LabelList)
row[OutputField] = Label
cursor.updateRow(row)
del row, cursor
Does anybody have any ideas where I'm screwing up on this?