<?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 overwrite input parameter with output parameter in ArcPy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1160197#M64243</link>
    <description>&lt;P&gt;out1 = arcpy.SetParameter(3, Point1)&lt;BR /&gt;out2 = arcpy.SetParameter(4, Point2)&lt;/P&gt;&lt;P&gt;Should probably&lt;SPAN&gt;&amp;nbsp;be at the end of the script. You're setting the outputs before doing anything with them. Try something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.env.overwriteOutput = True

#Inputs
Point1 = arcpy.GetParameterAsText(0)
Point2 = arcpy.GetParameterAsText(1)
Polygon = arcpy.GetParameterAsText(2)

# Select points that overlap the polygon
selected_points = arcpy.SelectLayerByLocation_management(Point1, 'INTERSECT',
Polygon).getOutput(0)

#Append selected points to the other layer.
arcpy.Append_management(selected_points, Point2, 'NO_TEST')

#Delete selected points from the original layer
arcpy.DeleteFeatures_management(selected_points)

OutPoint1 = arcpy.management.MakeFeatureLayer(Point1, "Point1")
OutPoint2 = arcpy.management.MakeFeatureLayer(Point2, "Point2")

#Outputs
out1 = arcpy.SetParameter(3, OutPoint1)
out2 = arcpy.SetParameter(4, OutPoint2)
&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 01 Apr 2022 09:24:58 GMT</pubDate>
    <dc:creator>Luke_Pinner</dc:creator>
    <dc:date>2022-04-01T09:24:58Z</dc:date>
    <item>
      <title>How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159253#M64212</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;I created a custom geoprocessing tool using Python in ArcGIS Pro and published it to use in Web AppBuilder. The results show with no issues in ArcGIS Pro, however, in Web AppBuilder, they don't, I believe the issue has to do with not specifying the output parameter correctly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;My issue now is how would I specify the output parameter to be the same as the input parameter? I added the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;arcpy.env.overwriteOutput = True&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;and I did set the output parameter to be derived. But when I run the tool, it doesn't give me any errors and it tells me that the results are drawn on the map, but the changes are not implemented.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Not too sure what I'm doing wrong.&lt;/P&gt;&lt;P&gt;Here's my Python script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;#Inputs&lt;/P&gt;&lt;P&gt;Point1 = arcpy.GetParameterAsText(0)&lt;BR /&gt;Point2 = arcpy.GetParameterAsText(1)&lt;BR /&gt;Polygon = arcpy.GetParameterAsText(2)&lt;/P&gt;&lt;P&gt;#Outputs&lt;/P&gt;&lt;P&gt;out1 = arcpy.SetParameter(3, Point1)&lt;BR /&gt;out2 = arcpy.SetParameter(4, Point2)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Select points that overlap the polygon&lt;BR /&gt;selected_points = arcpy.SelectLayerByLocation_management(Point1, 'INTERSECT',&lt;BR /&gt;Polygon)&lt;/P&gt;&lt;P&gt;#Append selected points to the other layer.&lt;BR /&gt;arcpy.Append_management(selected_points, Point2, 'NO_TEST')&lt;/P&gt;&lt;P&gt;#Deelete selected points from the original layer&lt;/P&gt;&lt;P&gt;arcpy.DeleteFeatures_management(selected_points)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 07:45:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159253#M64212</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-03-30T07:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159272#M64214</link>
      <description>&lt;P&gt;Just a thought.&amp;nbsp; Since delete features will do this to features that are selected, shouldn't you be deleting them from Point1 in your last line rather than the layer "selected_points".&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 08:54:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159272#M64214</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-03-30T08:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159316#M64216</link>
      <description>&lt;P&gt;Thank you for your response. That makes sense, I changed it to Point1 and it still works. It's just that I'm having the same problem still.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 12:02:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159316#M64216</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-03-30T12:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159330#M64217</link>
      <description>&lt;P&gt;MakeFeatureLayer is used as a step in the process, It may not be being done in the webapp environment&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 12:43:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159330#M64217</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-03-30T12:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159388#M64218</link>
      <description>&lt;P&gt;I'm not sure I've done this correctly, but here's my script after adding MakeFeatureLayer and it gives the same behavior:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanaNajeeb_0-1648649044596.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37702i02EBF8CB52BAC391/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanaNajeeb_0-1648649044596.png" alt="DanaNajeeb_0-1648649044596.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 14:02:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159388#M64218</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-03-30T14:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159390#M64219</link>
      <description>&lt;P&gt;I also tried to add the MakeFeatureLayer after setting the variables, same thing&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 14:04:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159390#M64219</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-03-30T14:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159660#M64234</link>
      <description>&lt;P&gt;How are parameters 3 &amp;amp; 4 defined in the toolbox? Data type, type, direction especially. Can you provide a screenshot of the toolbox script parameter properties?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 21:15:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159660#M64234</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-03-30T21:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159787#M64237</link>
      <description>&lt;P&gt;Sure, here's a screenshot.&lt;/P&gt;&lt;P&gt;For the dependency tab, I tried with and without it. But I don't seem to have the "Add result as operational layer" option available in the Web AppBuilder, in the widget settings, unless I specify the dependency parameter.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanaNajeeb_0-1648716017058.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37823iFB6617EB1CFE283D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanaNajeeb_0-1648716017058.png" alt="DanaNajeeb_0-1648716017058.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 08:40:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1159787#M64237</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-03-31T08:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1160197#M64243</link>
      <description>&lt;P&gt;out1 = arcpy.SetParameter(3, Point1)&lt;BR /&gt;out2 = arcpy.SetParameter(4, Point2)&lt;/P&gt;&lt;P&gt;Should probably&lt;SPAN&gt;&amp;nbsp;be at the end of the script. You're setting the outputs before doing anything with them. Try something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.env.overwriteOutput = True

#Inputs
Point1 = arcpy.GetParameterAsText(0)
Point2 = arcpy.GetParameterAsText(1)
Polygon = arcpy.GetParameterAsText(2)

# Select points that overlap the polygon
selected_points = arcpy.SelectLayerByLocation_management(Point1, 'INTERSECT',
Polygon).getOutput(0)

#Append selected points to the other layer.
arcpy.Append_management(selected_points, Point2, 'NO_TEST')

#Delete selected points from the original layer
arcpy.DeleteFeatures_management(selected_points)

OutPoint1 = arcpy.management.MakeFeatureLayer(Point1, "Point1")
OutPoint2 = arcpy.management.MakeFeatureLayer(Point2, "Point2")

#Outputs
out1 = arcpy.SetParameter(3, OutPoint1)
out2 = arcpy.SetParameter(4, OutPoint2)
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 01 Apr 2022 09:24:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1160197#M64243</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-04-01T09:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1160218#M64244</link>
      <description>&lt;P&gt;I tried that, still worked in ArcGIS Pro, but unfortunately, didn't change anything in the layer in Web AppBuilder. Thank you though!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 12:12:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1160218#M64244</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-04-01T12:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1160879#M64275</link>
      <description>&lt;P&gt;Thank you very much for your reply! I just republished the geoprocessing tool and it worked, I don't know what I did wrong when I told you it didn't work.&lt;/P&gt;&lt;P&gt;One last question, I want to specify a specific feature in the polygon layer by specifying the objectid value, I tried to do the following script, again, it works in ArcGIS Pro but it doesn't in WAB. Do you have an idea what could be the issue?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanaNajeeb_0-1649096027031.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38102iBACFFBE0E0C04CF0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanaNajeeb_0-1649096027031.png" alt="DanaNajeeb_0-1649096027031.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 18:12:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1160879#M64275</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-04-04T18:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1161489#M64287</link>
      <description>&lt;P&gt;Specified_Polygon is a Result object not a FeatureLayer. Use Specified_Polygon = arcpy.SelectLayerByAttribute_management(etc...)[0] or&amp;nbsp;arcpy.SelectLayerByAttribute_management(etc...).getOutput(0)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 08:28:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1161489#M64287</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-04-06T08:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to overwrite input parameter with output parameter in ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1161501#M64288</link>
      <description>&lt;P&gt;Oh, I get it now. Thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 09:42:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-overwrite-input-parameter-with-output/m-p/1161501#M64288</guid>
      <dc:creator>DanaNajeeb</dc:creator>
      <dc:date>2022-04-06T09:42:04Z</dc:date>
    </item>
  </channel>
</rss>

