<?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 Adding result table to ArcGIS Portal with web tool written in Python from ArcGIS Pro in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/adding-result-table-to-arcgis-portal-with-web-tool/m-p/653871#M50920</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a web tool created in ArcGIS Pro, that is supposed to add both a shapefile and a table as a result. The shapefile adds fine, but the table doesn't show up (it does in ArcGIS Pro). Could someone help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Find Varieties from Race&lt;BR /&gt;# Mette Balslev Greve&lt;BR /&gt;# June 2019&lt;/P&gt;&lt;P&gt;import arcpy as arcpy&lt;BR /&gt;import os&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;outDir = arcpy.env.scratchFolder&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Inputs&lt;BR /&gt;race = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Init - set variables and Clear previous selection of varieties&lt;BR /&gt;race_table = "Wheat_varieties_affected_by_races"&lt;BR /&gt;race_field = "Race"&lt;BR /&gt;variety_field_name = "Variety"&lt;BR /&gt;variety_fc_name = "DNA_variety_SR24"&lt;BR /&gt;arcpy.SelectLayerByAttribute_management(variety_fc_name, "CLEAR_SELECTION")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Select records with the chosen race&lt;BR /&gt;selection = "{}= '{}'".format(race_field, race) &lt;BR /&gt;arcpy.SelectLayerByAttribute_management(race_table, "NEW_SELECTION", selection)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Create table to hold varieties&lt;BR /&gt;variety_table = "Varieties.dbf"&lt;BR /&gt;variety_table_template = "Variety_template"&lt;BR /&gt;arcpy.CreateTable_management(outDir, variety_table, variety_table_template)&lt;BR /&gt;x = 0&lt;BR /&gt;full_path_table = os.path.join(outDir, variety_table)&lt;BR /&gt;cursor = arcpy.da.InsertCursor(full_path_table, "Variety")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Step through records with the chosen race&lt;BR /&gt;for row in arcpy.SearchCursor(race_table):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;# Return the variety and check if there is a field with that name in the variety fc&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;variety = row.getValue(variety_field_name)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;arcpy.ListFields(variety_fc_name, variety):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;selection = "{} &amp;gt; 0".format(variety)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.SelectLayerByAttribute_management(variety_fc_name, "ADD_TO_SELECTION", selection)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cursor.insertRow([variety])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;del cursor &lt;BR /&gt;output_layer_name = os.path.join(outDir, "Locations")&lt;BR /&gt;output_table_name = os.path.join(outDir, variety_table)&lt;BR /&gt;arcpy.CopyFeatures_management(variety_fc_name, output_layer_name)&lt;/P&gt;&lt;P&gt;arcpy.SetParameterAsText(1, output_layer_name)&lt;BR /&gt;arcpy.SetParameterAsText(2, output_table_name)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Exit - Clear selection of races&lt;BR /&gt;arcpy.SelectLayerByAttribute_management(race_table, "CLEAR_SELECTION")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Jun 2019 06:18:28 GMT</pubDate>
    <dc:creator>mettegreve</dc:creator>
    <dc:date>2019-06-11T06:18:28Z</dc:date>
    <item>
      <title>Adding result table to ArcGIS Portal with web tool written in Python from ArcGIS Pro</title>
      <link>https://community.esri.com/t5/python-questions/adding-result-table-to-arcgis-portal-with-web-tool/m-p/653871#M50920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a web tool created in ArcGIS Pro, that is supposed to add both a shapefile and a table as a result. The shapefile adds fine, but the table doesn't show up (it does in ArcGIS Pro). Could someone help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Find Varieties from Race&lt;BR /&gt;# Mette Balslev Greve&lt;BR /&gt;# June 2019&lt;/P&gt;&lt;P&gt;import arcpy as arcpy&lt;BR /&gt;import os&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;outDir = arcpy.env.scratchFolder&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Inputs&lt;BR /&gt;race = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Init - set variables and Clear previous selection of varieties&lt;BR /&gt;race_table = "Wheat_varieties_affected_by_races"&lt;BR /&gt;race_field = "Race"&lt;BR /&gt;variety_field_name = "Variety"&lt;BR /&gt;variety_fc_name = "DNA_variety_SR24"&lt;BR /&gt;arcpy.SelectLayerByAttribute_management(variety_fc_name, "CLEAR_SELECTION")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Select records with the chosen race&lt;BR /&gt;selection = "{}= '{}'".format(race_field, race) &lt;BR /&gt;arcpy.SelectLayerByAttribute_management(race_table, "NEW_SELECTION", selection)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Create table to hold varieties&lt;BR /&gt;variety_table = "Varieties.dbf"&lt;BR /&gt;variety_table_template = "Variety_template"&lt;BR /&gt;arcpy.CreateTable_management(outDir, variety_table, variety_table_template)&lt;BR /&gt;x = 0&lt;BR /&gt;full_path_table = os.path.join(outDir, variety_table)&lt;BR /&gt;cursor = arcpy.da.InsertCursor(full_path_table, "Variety")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Step through records with the chosen race&lt;BR /&gt;for row in arcpy.SearchCursor(race_table):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;# Return the variety and check if there is a field with that name in the variety fc&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;variety = row.getValue(variety_field_name)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;arcpy.ListFields(variety_fc_name, variety):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;selection = "{} &amp;gt; 0".format(variety)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.SelectLayerByAttribute_management(variety_fc_name, "ADD_TO_SELECTION", selection)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cursor.insertRow([variety])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;del cursor &lt;BR /&gt;output_layer_name = os.path.join(outDir, "Locations")&lt;BR /&gt;output_table_name = os.path.join(outDir, variety_table)&lt;BR /&gt;arcpy.CopyFeatures_management(variety_fc_name, output_layer_name)&lt;/P&gt;&lt;P&gt;arcpy.SetParameterAsText(1, output_layer_name)&lt;BR /&gt;arcpy.SetParameterAsText(2, output_table_name)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Exit - Clear selection of races&lt;BR /&gt;arcpy.SelectLayerByAttribute_management(race_table, "CLEAR_SELECTION")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2019 06:18:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-result-table-to-arcgis-portal-with-web-tool/m-p/653871#M50920</guid>
      <dc:creator>mettegreve</dc:creator>
      <dc:date>2019-06-11T06:18:28Z</dc:date>
    </item>
  </channel>
</rss>

