<?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 print result of a custom model in Python using Model Builder and ArcPy in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/how-to-print-result-of-a-custom-model-in-python/m-p/828741#M2150</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;model_result&lt;/STRONG&gt; is returned from the tool as a Result object. (Most tools, not just custom ones, return one or more results in a result object.)&lt;/P&gt;&lt;P&gt;Either &lt;STRONG&gt;str(model_result) &lt;/STRONG&gt;or &lt;STRONG&gt;model_result.GetOutput(0)&amp;nbsp;&lt;/STRONG&gt;should get your value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/result.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/result.htm"&gt;Result—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Nov 2017 18:41:56 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2017-11-26T18:41:56Z</dc:date>
    <item>
      <title>How to print result of a custom model in Python using Model Builder and ArcPy</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/how-to-print-result-of-a-custom-model-in-python/m-p/828740#M2149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a custom model (called TOOLNAME) in a custom toolbox developed in Model Builder on ArcGIS 10.1 Desktop. The model takes two input parameters (&lt;CODE&gt;SingleFDI_D&lt;/CODE&gt; and &lt;CODE&gt;dayindex&lt;/CODE&gt;) and outputs a Derived parameter called "&lt;CODE&gt;MaxFDI_DateTime&lt;/CODE&gt;" which is data of String type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="384610" alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/384610_DerivedParam1.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The model runs well within the Model Builder on ArcGIS Desktop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="384663" alt="" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/384663_DerivedParam2.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will need to execute the model in a standalone Python script as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is how to get the output of MaxFDI_DateTime out of the tool execution in Python.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class=""&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;ImportToolbox&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;TOOL_DIR&lt;/SPAN&gt;&lt;SPAN class=""&gt;)
&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;# The custom model should return a result in String, how to retrieve it here?
&lt;/SPAN&gt;&lt;SPAN class=""&gt;model_result &lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class=""&gt;.{&lt;/SPAN&gt;&lt;SPAN class=""&gt;TOOLNAME&lt;/SPAN&gt;&lt;SPAN class=""&gt;}&lt;/SPAN&gt;&lt;SPAN class=""&gt;_&lt;/SPAN&gt;&lt;SPAN class=""&gt;{&lt;/SPAN&gt;&lt;SPAN class=""&gt;TOOLBOX_ALIAS&lt;/SPAN&gt;&lt;SPAN class=""&gt;}(&lt;/SPAN&gt;&lt;SPAN class=""&gt;SingleFDI_D&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;SPAN class=""&gt; str&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;day&lt;/SPAN&gt;&lt;SPAN class=""&gt;))&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:59:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/how-to-print-result-of-a-custom-model-in-python/m-p/828740#M2149</guid>
      <dc:creator>AlexChen</dc:creator>
      <dc:date>2021-12-12T09:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to print result of a custom model in Python using Model Builder and ArcPy</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/how-to-print-result-of-a-custom-model-in-python/m-p/828741#M2150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;model_result&lt;/STRONG&gt; is returned from the tool as a Result object. (Most tools, not just custom ones, return one or more results in a result object.)&lt;/P&gt;&lt;P&gt;Either &lt;STRONG&gt;str(model_result) &lt;/STRONG&gt;or &lt;STRONG&gt;model_result.GetOutput(0)&amp;nbsp;&lt;/STRONG&gt;should get your value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/result.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/result.htm"&gt;Result—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2017 18:41:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/how-to-print-result-of-a-custom-model-in-python/m-p/828741#M2150</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-11-26T18:41:56Z</dc:date>
    </item>
  </channel>
</rss>

