<?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: Use script tool output parameter in model builder in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/use-script-tool-output-parameter-in-model-builder/m-p/1234121#M66157</link>
    <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;yes it is correct. sys.argv[i] starts from 1, and Get/SetParameter[i] starts from 0.&lt;/P&gt;&lt;P&gt;It works now, I forgot to check 'add to display' in my model builder...&lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2022 15:22:21 GMT</pubDate>
    <dc:creator>JulietteLapeyre</dc:creator>
    <dc:date>2022-11-22T15:22:21Z</dc:date>
    <item>
      <title>Use script tool output parameter in model builder</title>
      <link>https://community.esri.com/t5/python-questions/use-script-tool-output-parameter-in-model-builder/m-p/1233798#M66150</link>
      <description>&lt;P&gt;I created a model builder which produce a summary statistics table, and a script tool which use this table in input, and tranpose it the way I whish to display results. I then want to join the reformated table from script tool, to a layer.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The issue is that the output of the script tool is not created, and I don't understand why.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JulietteLapeyre_2-1669046344486.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56504i0935AC6C06E928DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JulietteLapeyre_2-1669046344486.png" alt="JulietteLapeyre_2-1669046344486.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) summary statistics table created in the model builder&lt;/P&gt;&lt;TABLE border="1" width="50.0%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;id&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;disruptive_element&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;disruptive_surface&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;29&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;cp&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;800&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;29&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;rb&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29&lt;/TD&gt;&lt;TD&gt;aut&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;cp&lt;/TD&gt;&lt;TD&gt;400&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) transposed table, produced in the script tool&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;id&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;cp&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;rb&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;aut&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;29&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;800&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;500&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;400&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;30&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;400&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;0&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I defined the input and output parameters in the script tool properties, and wrote the script in the execution tab.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JulietteLapeyre_0-1669046011935.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56501i8AC0D1B1ADC81D6B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JulietteLapeyre_0-1669046011935.png" alt="JulietteLapeyre_0-1669046011935.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JulietteLapeyre_1-1669046066652.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56502iDCDDC073109FB025/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JulietteLapeyre_1-1669046066652.png" alt="JulietteLapeyre_1-1669046066652.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;At the end of the script, there are the following lines. the csv is saved, but the table is not created in the geodatabse.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Set local variables
out_name = "outStats.csv"
saving_path = os.path.join(homeFolder, out_name)
pivot_df.to_csv(saving_path, sep=',', index=True)

arcpy.MakeTableView_management(in_table=saving_path, out_view='viewtemp')
outTab = arcpy.TableToTable_conversion('viewtemp', defaultGDB, 'tempTable')
arcpy.SetParameter(1, outTab)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Join the previous table to a polygon layer, which contains the ids&lt;/P&gt;&lt;P&gt;this step doesn't work yet&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 18:15:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-script-tool-output-parameter-in-model-builder/m-p/1233798#M66150</guid>
      <dc:creator>JulietteLapeyre</dc:creator>
      <dc:date>2022-11-21T18:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Use script tool output parameter in model builder</title>
      <link>https://community.esri.com/t5/python-questions/use-script-tool-output-parameter-in-model-builder/m-p/1233930#M66152</link>
      <description>&lt;P&gt;are the sys.args[i] indexing in your execution code correct? Should they be 0 and 1 perhaps?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 21:43:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-script-tool-output-parameter-in-model-builder/m-p/1233930#M66152</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-11-21T21:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Use script tool output parameter in model builder</title>
      <link>https://community.esri.com/t5/python-questions/use-script-tool-output-parameter-in-model-builder/m-p/1234121#M66157</link>
      <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;yes it is correct. sys.argv[i] starts from 1, and Get/SetParameter[i] starts from 0.&lt;/P&gt;&lt;P&gt;It works now, I forgot to check 'add to display' in my model builder...&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 15:22:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-script-tool-output-parameter-in-model-builder/m-p/1234121#M66157</guid>
      <dc:creator>JulietteLapeyre</dc:creator>
      <dc:date>2022-11-22T15:22:21Z</dc:date>
    </item>
  </channel>
</rss>

