<?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: Need Help with Python Script in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069022#M6214</link>
    <description>i tried the line but i get the error in the attachment. i tried valve size without the underscore and no space same error.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;</description>
    <pubDate>Wed, 16 Jun 2021 18:18:52 GMT</pubDate>
    <dc:creator>markheinrichs</dc:creator>
    <dc:date>2021-06-16T18:18:52Z</dc:date>
    <item>
      <title>Need Help with Python Script</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1068942#M6209</link>
      <description>&lt;P&gt;In my attribute i have 2 columns&amp;nbsp; i need to address. the layer is water valves and the 2 columns are valve size and exercised picture is attached. i need to reset my exercised column from yes back to null annually&amp;nbsp; which i have the script for but i need to address the valve size 6",8",10",12" etc. individually so i can reset just that valve size. any ideas are appreciated.&lt;/P&gt;&lt;P&gt;thanks in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 15:48:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1068942#M6209</guid>
      <dc:creator>markheinrichs</dc:creator>
      <dc:date>2021-06-16T15:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Python Script</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1068956#M6210</link>
      <description>&lt;P&gt;I would just use a simple field calculation with python. either GP tool or right-click on the field in the attribute table and select calculate field.&amp;nbsp; I would also make a copy/backup of your data before doing anything.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/calculate-field.htm" target="_blank"&gt;Calculate Field (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;select Python as the language and then something like (NB you have aliases for your fields so use their real names in the below code):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if !valve_size! == '12"':
  return None&lt;/LI-CODE&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;</description>
      <pubDate>Wed, 16 Jun 2021 16:13:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1068956#M6210</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-06-16T16:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Python Script</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1068990#M6212</link>
      <description>&lt;P&gt;So it sounds like you'd like to modify your python script to not only set the "Exercised" column back to NULL but also to do something with valve size. I can't exactly tell from your question what you need to do with the "Valve Size" column. Perhaps, you are wanting to just reset the "Exercised" column to NULL for valves of a certain size? If that is the case, I would use an update cursor with a where clause.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# set up an update cursor including any fields that you'll need updated or to determine what to update
with arcpy.da.UpdateCursor(fcPath, field_names=['UNITID', 'VALVESZ', 'Exercised'], where_clause='VALVESZ IN (6, 8, 10)') as cursor:
    for valve in cursor:
        if (valve[2] != None): # None is python's equivalent of NULL
            valve[2] = None

            cursor.updateRow(valve)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Jun 2021 17:15:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1068990#M6212</guid>
      <dc:creator>DougGreen</dc:creator>
      <dc:date>2021-06-16T17:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Python Script</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069022#M6214</link>
      <description>i tried the line but i get the error in the attachment. i tried valve size without the underscore and no space same error.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jun 2021 18:18:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069022#M6214</guid>
      <dc:creator>markheinrichs</dc:creator>
      <dc:date>2021-06-16T18:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Python Script</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069026#M6215</link>
      <description>&lt;P&gt;Can you perhaps check what the real field name is?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 18:21:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069026#M6215</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-06-16T18:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Python Script</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069034#M6216</link>
      <description>attached is a picture of the field names.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jun 2021 18:36:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069034#M6216</guid>
      <dc:creator>markheinrichs</dc:creator>
      <dc:date>2021-06-16T18:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Python Script</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069059#M6219</link>
      <description>Thanks for the reply. i have 1774 different valves made up of 6 different sizes and we have to exercise them at different times to meet the state regs. i use python 3 script !Exercised!.replace("Yes","") to set everything that is yes back to null like it says and that works, but it is almost all the valves and i do want to pick the size and do just that size. the state wants 10" and 12" done every 2 years and anything smaller every 4 . i'm new to this and got lost in your answer but appreciate the quick response.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jun 2021 19:29:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069059#M6219</guid>
      <dc:creator>markheinrichs</dc:creator>
      <dc:date>2021-06-16T19:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Python Script</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069155#M6220</link>
      <description>&lt;P&gt;No that's a picture of the attribute table with the field aliases.&lt;/P&gt;&lt;P&gt;Just find the fieldname in the expression window, then:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#enter this in the box below the '='
myFunction(!The name of your field as it appears in the fields window above!)

#enter this in the 'code block' window
def myFunction(size)
  if size == '12"':
    return None&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Jun 2021 22:55:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/need-help-with-python-script/m-p/1069155#M6220</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-06-16T22:55:00Z</dc:date>
    </item>
  </channel>
</rss>

