<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using field lists in arcpy.da update cursor to calculate percentage in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1031519#M60166</link>
    <description>&lt;P&gt;Thank you! I ended up doing something a little different because even when I changed my fieldnames to be the appropriate format, it was throwing an error.&lt;/P&gt;&lt;P&gt;Here's what I came up with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Calculate sum field for sum of all values 
crop_table_all = r'E:\FATHOM\2020FATHOM\Analysis\MR_cropscape_2016_FPstats_02062021.gdb\Cropscape_MR_floodplain_statsALL'
cropfieldlist = [f.name for f in arcpy.ListFields(crop_table_all,"VALUE_*","")]
print (cropfieldlist)

fieldName1 = "VALUE_SUM"
arcpy.AddField_management(crop_table_all, fieldName1, "DOUBLE","", "", "", "", "")

with arcpy.da.UpdateCursor(crop_table_all, cropfieldlist) as cursor:
    for row in cursor:
        row[-1] = sum(row[:-2])
        cursor.updateRow(row)
        
fieldName5 = "Pct_Ag_Cropscape_FATHOM"
fieldName2 = "Pct_AgPlus_FATHOM"
fieldName3 = "Pct_Natural_FATHOM"
fieldName4 = "Pct_Developed_FATHOM"
fieldName6 = "Pct_Disturbed_FATHOM"
arcpy.AddField_management(crop_table_all, fieldName5, "DOUBLE","", "", "", "", "")
arcpy.AddField_management(crop_table_all, fieldName2, "DOUBLE","", "", "", "", "")
arcpy.AddField_management(crop_table_all, fieldName3, "DOUBLE","", "", "", "", "")
arcpy.AddField_management(crop_table_all, fieldName4, "DOUBLE","", "", "", "", "")
arcpy.AddField_management(crop_table_all, fieldName6, "DOUBLE","", "", "", "", "")
expression2 = "((!Value_1! + !Value_2! + !Value_3! + !Value_5! + !Value_12! + !Value_13! + !Value_42! + !Value_26! + !Value_52! + !Value_225! + !Value_226! + !Value_228! + !Value_232! + !Value_237! + !Value_238! + !Value_239! + !Value_240! +!Value_241! + !Value_254!) / (!VALUE_sum!)) *100"
expression3 = "(( !Value_111!+ !Value_131!+ !Value_141!+ !Value_142!+ !Value_143!+ !Value_152!+ !Value_190!+ !Value_195!) / (!VALUE_sum!)) *100"
expression4 = "((!VALUE_121!+!VALUE_122!+!VALUE_123!+ !VALUE_124!) / (!VALUE_sum!)) *100"
expression5 = "100 - (!Pct_Natural_FATHOM! + !Pct_Disturbed_FATHOM!)"
expression6 = "(!Pct_Ag_Cropscape_FATHOM! + !Pct_Developed_FATHOM!)"
arcpy.CalculateField_management(crop_table_all, fieldName5, expression5, "PYTHON_9.3") 
arcpy.CalculateField_management(crop_table_all, fieldName2, expression2, "PYTHON_9.3")
arcpy.CalculateField_management(crop_table_all, fieldName3, expression3, "PYTHON_9.3")
arcpy.CalculateField_management(crop_table_all, fieldName4, expression4, "PYTHON_9.3")
arcpy.CalculateField_management(crop_table_all, fieldName6, expression6, "PYTHON_9.3")   &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Mar 2021 15:25:31 GMT</pubDate>
    <dc:creator>KathleenHoenke</dc:creator>
    <dc:date>2021-03-01T15:25:31Z</dc:date>
    <item>
      <title>Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029770#M60066</link>
      <description>&lt;P&gt;I'm trying to make some calculations using lists of fields. I need to make a list of the fields in a table, and then add them together as part of a percentage calculation. Here's my script, but I think my syntax is wrong. Help is appreciated!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# too many cropscape value fields. Use table field list to calculate percentages (hopefully).
crop_table_all = r'E:\FATHOM\2020FATHOM\Analysis\MR_cropscape_2016_FPstats_02062021.gdb\Cropscape_MR_floodplain_statsALL'     
# List of all fields in the table   
cropfieldlist = [f.name for f in arcpy.ListFields(crop_table_all,"VALUE_*","")]
print(cropfieldlist)
#list of only the fields representing developed landcover.
developedfieldlist =['Value_121','Value_122','Value_123!', '!Value_124!']
# add result field
fieldName4 = "Pct_Disturbed_FATHOM"
arcpy.AddField_management(crop_table_all, fieldName4, "DOUBLE")
#Calculate percent developed
with arcpy.da.UpdateCursor(crop_table_all, developedfieldlist, cropfieldlist,fieldName4) as cursor:
    for row in cursor:
        # Update the Pct_Area field to be the (Area_Sqm field / Shape_Area) *100
        # ROAD_TYPE field.
        if row[1] != 0:
            row[3] = (sum[row [1]] / sum[row[2]]) * 100
            cursor.updateRow(row)
            else:
                print (0)
    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 21:21:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029770#M60066</guid>
      <dc:creator>KathleenHoenke</dc:creator>
      <dc:date>2021-02-23T21:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029778#M60067</link>
      <description>&lt;P&gt;You are passing three lists into the cursor without concatenating them into one, and its being assigned into wrong parameters&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UpdateCursor (in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {sql_clause}, {datum_transformation) &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Create a single list of the fields and try that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 21:31:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029778#M60067</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-23T21:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029780#M60068</link>
      <description>&lt;P&gt;It would be helpful to mention any error messages you are receiving. If there are no errors, then what is the incorrect behavior you're seeing?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 21:33:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029780#M60068</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-02-23T21:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029785#M60069</link>
      <description>&lt;P&gt;you have a field name called&amp;nbsp;&lt;/P&gt;&lt;P&gt;'!Value_124!'&lt;BR /&gt;? Might be right but thought it wasn't a valid 1st character.&lt;/P&gt;&lt;P&gt;I may be wrong but the syntax of the cursor seems way off.&amp;nbsp; You can only specify one list of fields, then you're using cropfieldslist as an argument where the WHERE clause would be, then fieldname4 where the spatial reference would go.&amp;nbsp;UpdateCursor—ArcGIS Pro | Documentation&lt;BR /&gt;can you elaborate more in the code comments or a as a reply on what you're expecting from the 2 input fields and fieldname4?&lt;/P&gt;&lt;P&gt;Also your else block is indented 1 indent to far (should be same indent as if block)&lt;/P&gt;&lt;P&gt;Also what is sum doing? there is a sum() method but you seem to be trying to index slice it, is sum a tuple or list you havent detailed?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 21:36:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029785#M60069</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-23T21:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029859#M60080</link>
      <description>&lt;P&gt;Thank you for the repoly! Whoops, yes, that is a stray exclamation point... I got confused because it isnt needed in the update cursor (but it is for calculate field which is why I was confused! Thank you for pointing that out).&lt;/P&gt;&lt;P&gt;I want to use an update cursor (or maybe calculate field is better? To essentially update fieldname4 with the percentage created by the sum of the fields in the developedfield list over the sum of the fields in the cropfieldlist, like this:&amp;nbsp; &amp;nbsp;(sum(developedfieldlist) / sum(cropfieldlist)) * 100....&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 01:06:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029859#M60080</guid>
      <dc:creator>KathleenHoenke</dc:creator>
      <dc:date>2021-02-24T01:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029876#M60082</link>
      <description>&lt;P&gt;Thank you for this. How can I concatenate them into one, when I need to divide one list by the other?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 03:09:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029876#M60082</guid>
      <dc:creator>KathleenHoenke</dc:creator>
      <dc:date>2021-02-24T03:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029886#M60084</link>
      <description>&lt;P&gt;There are several ways, and using what you have posted in the original message and substituting some pseudo values for the ListFields comprehension:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cropfieldlist = [f.name for f in arcpy.ListFields(crop_table_all,"VALUE_*","")]
developedfieldlist =['Value_121', 'Value_122', 'Value_123', 'Value_124']
fieldName4 = ["Pct_Disturbed_FATHOM"]

listForCursor = cropfieldlist + developedfieldlist + fieldName4&lt;/LI-CODE&gt;&lt;P&gt;produces the concatenated list:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;['croplist_1', 'croplist_2', 'croplist_3', 'croplist_4', 'Value_121', 'Value_122', 'Value_123', 'Value_124', 'Pct_Disturbed_FATHOM']&lt;/LI-CODE&gt;&lt;P&gt;For your calculation, you can use the index from their position in the concatenated list used for your cursor.&amp;nbsp; Step through with your debugger and adjust your calculation variables to use the field's index that you need to use.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;row[6]  = row[0]+row[1]+row[2] ... / row[3]+row[4]+row[5]...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 03:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1029886#M60084</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-24T03:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030000#M60088</link>
      <description>&lt;P&gt;If this is just one feature class and you know all the fields, I would just say do it in field calculator&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 14:44:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030000#M60088</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-24T14:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030031#M60090</link>
      <description>&lt;P&gt;When I attempt it in field calculator, here's the error I get....&lt;/P&gt;&lt;LI-CODE lang="python"&gt;crop_table_all = r'E:\FATHOM\2020FATHOM\Analysis\MR_cropscape_2016_FPstats_02062021.gdb\Cropscape_MR_floodplain_statsALL'        
cropfieldlist = [f.name for f in arcpy.ListFields(crop_table_all,"VALUE_*","")]
print(cropfieldlist)
developedfieldlist =['VALUE_121','VALUE_122','VALUE_123', 'VALUE_124']
fieldName4 = "Pct_Disturbed_FATHOM"
arcpy.AddField_management(crop_table_all, fieldName4, "DOUBLE")
expression4 = """sum(developedfieldlist) / sum(cropfieldlist) *100"""
arcpy.CalculateField_management(crop_table_all, fieldName4, expression4, "PYTHON_9.3")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5209, in CalculateField&lt;BR /&gt;raise e&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5206, in CalculateField&lt;BR /&gt;retval = convertArcObjectToPythonObject(gp.CalculateField_management(*gp_fixargs((in_table, field, expression, expression_type, code_block, field_type), True)))&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 511, in &amp;lt;lambda&amp;gt;&lt;BR /&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;arcgisscripting.ExecuteError: ERROR 000539: Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt;TypeError: unsupported operand type(s) for +: 'int' and 'str'&lt;/P&gt;&lt;P&gt;Failed to execute (CalculateField).&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 15:54:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030031#M60090</guid>
      <dc:creator>KathleenHoenke</dc:creator>
      <dc:date>2021-02-24T15:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030274#M60103</link>
      <description>&lt;P&gt;Thank you, however, since there are over 100 fields, I want to avoid typing row[1] - row[100], is it possible to do that? That was why I wanted to make a list to use in the first place.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 23:16:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030274#M60103</guid>
      <dc:creator>KathleenHoenke</dc:creator>
      <dc:date>2021-02-24T23:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030281#M60105</link>
      <description>&lt;P&gt;The error message is saying there is a TypeError and that it cannot add ints and strings.&amp;nbsp; You may have some fields that are strings so you will have to figure a way to convert them to ints in order to perform the sum operation.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 23:30:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030281#M60105</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-24T23:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030298#M60106</link>
      <description>At this point, I’d say calculate field would be a better option. For the sake of dynamically creating rows[], you can concatenate the fieldlist so that the target field is in the first index. Then you can set up an iterative range user the for row in cursor: line.&lt;BR /&gt;&lt;BR /&gt;for i in range(1, len(your fieldlist):&lt;BR /&gt;&lt;BR /&gt;to create the index starting at 1 and ending at the length of how many fields you have. Then you append that int(row[i]) *from your type error I think you have strings in your fields so convert to int* to a list of&lt;BR /&gt;&lt;BR /&gt;fieldvalueslist.append(int(row[i]))&lt;BR /&gt;&lt;BR /&gt;which you can then use for your calculations. row[0] = sum(fieldvalueslist)&lt;BR /&gt;&lt;BR /&gt;there are better methods to achieve what you need though. See the comment on your type error that you posted and see if you can find where the strings are.&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Feb 2021 00:08:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030298#M60106</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-25T00:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030318#M60107</link>
      <description>&lt;P&gt;Thank you, I think I fixed that by removing the one text field from the list. I now get the error:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5209, in CalculateField&lt;BR /&gt;raise e&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5206, in CalculateField&lt;BR /&gt;retval = convertArcObjectToPythonObject(gp.CalculateField_management(*gp_fixargs((in_table, field, expression, expression_type, code_block, field_type), True)))&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 511, in &amp;lt;lambda&amp;gt;&lt;BR /&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;RuntimeError: Object: Error in executing tool&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 02:35:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030318#M60107</guid>
      <dc:creator>KathleenHoenke</dc:creator>
      <dc:date>2021-02-25T02:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030320#M60108</link>
      <description>&lt;P&gt;Reading through the documentation for the calculatefield, it says that if you are using python as the expression type you need to denote the fields as '!fieldname!'.&amp;nbsp; I also think the 'Python_9.3' should just be 'PYTHON3'.&lt;/P&gt;&lt;P&gt;To get your fields formatted correctly, you can add the ! to the list of fields that you typed out, and you can do&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[f'!{f.name}!' for f in arcpy.ListFields(crop_table_all,"VALUE_*","")]&lt;/LI-CODE&gt;&lt;P&gt;for the dynamically created list.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 03:01:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1030320#M60108</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-25T03:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using field lists in arcpy.da update cursor to calculate percentage</title>
      <link>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1031519#M60166</link>
      <description>&lt;P&gt;Thank you! I ended up doing something a little different because even when I changed my fieldnames to be the appropriate format, it was throwing an error.&lt;/P&gt;&lt;P&gt;Here's what I came up with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Calculate sum field for sum of all values 
crop_table_all = r'E:\FATHOM\2020FATHOM\Analysis\MR_cropscape_2016_FPstats_02062021.gdb\Cropscape_MR_floodplain_statsALL'
cropfieldlist = [f.name for f in arcpy.ListFields(crop_table_all,"VALUE_*","")]
print (cropfieldlist)

fieldName1 = "VALUE_SUM"
arcpy.AddField_management(crop_table_all, fieldName1, "DOUBLE","", "", "", "", "")

with arcpy.da.UpdateCursor(crop_table_all, cropfieldlist) as cursor:
    for row in cursor:
        row[-1] = sum(row[:-2])
        cursor.updateRow(row)
        
fieldName5 = "Pct_Ag_Cropscape_FATHOM"
fieldName2 = "Pct_AgPlus_FATHOM"
fieldName3 = "Pct_Natural_FATHOM"
fieldName4 = "Pct_Developed_FATHOM"
fieldName6 = "Pct_Disturbed_FATHOM"
arcpy.AddField_management(crop_table_all, fieldName5, "DOUBLE","", "", "", "", "")
arcpy.AddField_management(crop_table_all, fieldName2, "DOUBLE","", "", "", "", "")
arcpy.AddField_management(crop_table_all, fieldName3, "DOUBLE","", "", "", "", "")
arcpy.AddField_management(crop_table_all, fieldName4, "DOUBLE","", "", "", "", "")
arcpy.AddField_management(crop_table_all, fieldName6, "DOUBLE","", "", "", "", "")
expression2 = "((!Value_1! + !Value_2! + !Value_3! + !Value_5! + !Value_12! + !Value_13! + !Value_42! + !Value_26! + !Value_52! + !Value_225! + !Value_226! + !Value_228! + !Value_232! + !Value_237! + !Value_238! + !Value_239! + !Value_240! +!Value_241! + !Value_254!) / (!VALUE_sum!)) *100"
expression3 = "(( !Value_111!+ !Value_131!+ !Value_141!+ !Value_142!+ !Value_143!+ !Value_152!+ !Value_190!+ !Value_195!) / (!VALUE_sum!)) *100"
expression4 = "((!VALUE_121!+!VALUE_122!+!VALUE_123!+ !VALUE_124!) / (!VALUE_sum!)) *100"
expression5 = "100 - (!Pct_Natural_FATHOM! + !Pct_Disturbed_FATHOM!)"
expression6 = "(!Pct_Ag_Cropscape_FATHOM! + !Pct_Developed_FATHOM!)"
arcpy.CalculateField_management(crop_table_all, fieldName5, expression5, "PYTHON_9.3") 
arcpy.CalculateField_management(crop_table_all, fieldName2, expression2, "PYTHON_9.3")
arcpy.CalculateField_management(crop_table_all, fieldName3, expression3, "PYTHON_9.3")
arcpy.CalculateField_management(crop_table_all, fieldName4, expression4, "PYTHON_9.3")
arcpy.CalculateField_management(crop_table_all, fieldName6, expression6, "PYTHON_9.3")   &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 15:25:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-field-lists-in-arcpy-da-update-cursor-to/m-p/1031519#M60166</guid>
      <dc:creator>KathleenHoenke</dc:creator>
      <dc:date>2021-03-01T15:25:31Z</dc:date>
    </item>
  </channel>
</rss>

