<?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: Python Toolbox selected field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-toolbox-selected-field/m-p/1104232#M62577</link>
    <description>&lt;P&gt;Is your script attached to a tool in Arctoolbox?&lt;/P&gt;&lt;P&gt;If not then you have to provide the values for the parameters either in the code or via the command line.&lt;/P&gt;&lt;P&gt;Input_Feature = r"C:\somefolder\some_gdb\input_featureclass"&lt;/P&gt;&lt;P&gt;Field = "Field_to_use"&lt;/P&gt;&lt;P&gt;Output_Feature&amp;nbsp;= r"C:\somefolder\some_gdb\output_featureclass"&lt;/P&gt;&lt;P&gt;and the change from equality to assignment statements is correct.&lt;/P&gt;&lt;P&gt;If you intend to create a toolbox with a tool, see&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/geoprocessing_and_python/a-quick-tour-of-creating-tools-in-python.htm" target="_blank"&gt;A quick tour of creating tools with Python—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;focus on the "custom" tools&lt;/P&gt;</description>
    <pubDate>Sun, 03 Oct 2021 09:18:55 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-10-03T09:18:55Z</dc:date>
    <item>
      <title>Python Toolbox selected field</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-selected-field/m-p/1104178#M62574</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I have a script that creates a new field and then chooses the field of diameter and runs an equation to convert it from millimeters to meters and then makes a Buffer&lt;BR /&gt;But there is a problem with the script that I don't know about&lt;BR /&gt;Note: This is my first try&lt;/P&gt;&lt;P&gt;My&amp;nbsp;script&amp;nbsp;&lt;/P&gt;&lt;P&gt;Import arcpy&lt;/P&gt;&lt;P&gt;# Script arguments&lt;BR /&gt;Input_Feature == arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;Field == arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;Output_Feature == arcpy.GetParameterAsText(2)&lt;/P&gt;&lt;P&gt;New_Field == "Buf"&lt;/P&gt;&lt;P&gt;Expression == "{ }".format ((!Field!/1000)/2)&lt;/P&gt;&lt;P&gt;# Local variables:&lt;BR /&gt;Feature_2 = Input_Feature&lt;BR /&gt;Feature_3 = Feature_2&lt;/P&gt;&lt;P&gt;# Process: Add Field&lt;BR /&gt;arcpy.AddField_management(Input_Feature, "Buf", "FLOAT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")&lt;/P&gt;&lt;P&gt;# Process: Calculate Field&lt;BR /&gt;arcpy.CalculateField_management(Feature_2, "Buf", "Expression ", "PYTHON", "")&lt;/P&gt;&lt;P&gt;# Process: Buffer&lt;BR /&gt;arcpy.Buffer_analysis(Feature_3, Output_Feature, "Buf", Side_Type, End_Type, "NONE", "", Method)&lt;/P&gt;</description>
      <pubDate>Sat, 02 Oct 2021 10:01:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-selected-field/m-p/1104178#M62574</guid>
      <dc:creator>KhaledYousefMohammedAhmed</dc:creator>
      <dc:date>2021-10-02T10:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox selected field</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-selected-field/m-p/1104179#M62575</link>
      <description>&lt;P&gt;Input_Feature&lt;STRONG&gt; ==&lt;/STRONG&gt; arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;This is not an assignment statement, it is an equality check (&lt;STRONG&gt;==&lt;/STRONG&gt;), I suspect you want to assign your parameters to variables so you need to use&lt;/P&gt;&lt;P&gt;I&lt;SPAN&gt;nput_Feature &lt;STRONG&gt;=&lt;/STRONG&gt; arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Oct 2021 12:02:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-selected-field/m-p/1104179#M62575</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-10-02T12:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox selected field</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-selected-field/m-p/1104230#M62576</link>
      <description>&lt;P&gt;First, thanks for your interest&lt;BR /&gt;Second, I have already tried this method and it did not work. The real problem is that the script is telling the program to choose a field from the input layer and enter this chosen field into the equation&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 08:44:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-selected-field/m-p/1104230#M62576</guid>
      <dc:creator>KhaledYousefMohammedAhmed</dc:creator>
      <dc:date>2021-10-03T08:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox selected field</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-selected-field/m-p/1104232#M62577</link>
      <description>&lt;P&gt;Is your script attached to a tool in Arctoolbox?&lt;/P&gt;&lt;P&gt;If not then you have to provide the values for the parameters either in the code or via the command line.&lt;/P&gt;&lt;P&gt;Input_Feature = r"C:\somefolder\some_gdb\input_featureclass"&lt;/P&gt;&lt;P&gt;Field = "Field_to_use"&lt;/P&gt;&lt;P&gt;Output_Feature&amp;nbsp;= r"C:\somefolder\some_gdb\output_featureclass"&lt;/P&gt;&lt;P&gt;and the change from equality to assignment statements is correct.&lt;/P&gt;&lt;P&gt;If you intend to create a toolbox with a tool, see&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/geoprocessing_and_python/a-quick-tour-of-creating-tools-in-python.htm" target="_blank"&gt;A quick tour of creating tools with Python—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;focus on the "custom" tools&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 09:18:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-selected-field/m-p/1104232#M62577</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-10-03T09:18:55Z</dc:date>
    </item>
  </channel>
</rss>

