<?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: How to update short vb code to python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526473#M41240</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You would need to put it in a Python definition function:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/206348_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 May 2016 11:03:46 GMT</pubDate>
    <dc:creator>FC_Basson</dc:creator>
    <dc:date>2016-05-30T11:03:46Z</dc:date>
    <item>
      <title>How to update short vb code to python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526472#M41239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I created a short model to update one field based on another in a SQl geodatabase using modelbuilder, exported it to python, however it only works in pyscripter not in python.&lt;/P&gt;&lt;P&gt;It seems Calculate field cannot use VB expressions in 64-bit ArcGIS products. I'm not sure of python so can anyone tell me how to change this vb code into python in the Code Block of Calculate Field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If IsNull ([ColumnA]) then&lt;/P&gt;&lt;P&gt;[ColumnA] = [ColumnB]&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ColumnA is a date field so if it is Null then update it with ColumnB (text field).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Rachel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 May 2016 09:20:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526472#M41239</guid>
      <dc:creator>RachelS</dc:creator>
      <dc:date>2016-05-30T09:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to update short vb code to python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526473#M41240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You would need to put it in a Python definition function:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/206348_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 May 2016 11:03:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526473#M41240</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2016-05-30T11:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to update short vb code to python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526474#M41241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;/PRE&gt;&lt;P&gt;Thank you, this worked and the model runs with the python in the codeblock, however when I export it to python and run it, it's saying Error 000732: Input Table x does not exist or is not supported. Failed to execute (calculate Field).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what my python script looks like&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy
# Local variables:
Seizures_DBO_Seizures = "Database Servers\\servername_SQLEXPRESS.gds\\Seizures (VERSION:dbo.DEFAULT)\\Seizures.DBO.Seizures"
Seizures_DBO_Seizures2 = Seizures_DBO_Seizures
# Process: Calculate Field
arcpy.CalculateField_management(Seizures_DBO_Seizures, "Date_Seized", "setField( !Date_Seized!, !DateSeized!)", "PYTHON_9.3", "def setField( val1, val2 ):\\n&amp;nbsp; if val1 is None:\\n&amp;nbsp;&amp;nbsp;&amp;nbsp; return val2\\n&amp;nbsp; else:\\n&amp;nbsp;&amp;nbsp;&amp;nbsp; return val1")&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Date_Seized was ColumnA&lt;/P&gt;&lt;P&gt;And DateSeized was ColumnB.&lt;/P&gt;&lt;P&gt;Would it be something to do with the blackslashes is doesn't like?&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Rachel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:56:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526474#M41241</guid>
      <dc:creator>RachelS</dc:creator>
      <dc:date>2021-12-11T22:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to update short vb code to python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526475#M41242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try setting your input parameters as variables before running the Calculate Field step as on this example page: &lt;A href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm"&gt;Calculate Field—Data Management toolbox | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp; (search for the Calculate ranges example)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 May 2016 13:36:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526475#M41242</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2016-05-30T13:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to update short vb code to python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526476#M41243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I changed the filepath to&lt;/P&gt;&lt;P&gt;r"C:\Users\mynamet\AppData\Roaming\ESRI\Desktop10.3\ArcCatalog\databasename\datasetname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and that seems to have done the trick.&lt;/P&gt;&lt;P&gt;Many thanks for your help&lt;/P&gt;&lt;P&gt;Rachel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2016 08:22:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-short-vb-code-to-python/m-p/526476#M41243</guid>
      <dc:creator>RachelS</dc:creator>
      <dc:date>2016-05-31T08:22:58Z</dc:date>
    </item>
  </channel>
</rss>

