<?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: Default arcpy.GetParameterAsText(0) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/default-arcpy-getparameterastext-0/m-p/569917#M44679</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you creating a tool in a toolbox for your user input?&amp;nbsp; If so, you you set up you default int he Parmaters box, for example:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="264307" alt="" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/264307_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in the script, you could have something like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Script arguments...&lt;/SPAN&gt;
targetGDB &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetParameterAsText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; targetGDB&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp; targetGDB &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'\\DFGANCGISDEV3\agsdev\data\update.gdb'&lt;/SPAN&gt; ‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simple sample, but then you repeat for the other parameters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: by the way, I should mention that they will see the default you have in the Parameter box, but can change it.&amp;nbsp;&amp;nbsp; The "if not" covers if nothing is input....at least you ahve the default, for example if you didn't have a default in the Parameter box, and they left the input blank, you could still have the default.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 00:32:15 GMT</pubDate>
    <dc:creator>RebeccaStrauch__GISP</dc:creator>
    <dc:date>2021-12-12T00:32:15Z</dc:date>
    <item>
      <title>Default arcpy.GetParameterAsText(0)</title>
      <link>https://community.esri.com/t5/python-questions/default-arcpy-getparameterastext-0/m-p/569914#M44676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to default Get parametersAsTest&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where when I run the tool it will be defaulted unless the user changes it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;main&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
sde_conn &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetParameterAsText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\Users\xx\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\x@x.sde"&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:32:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/default-arcpy-getparameterastext-0/m-p/569914#M44676</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2021-12-12T00:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Default arcpy.GetParameterAsText(0)</title>
      <link>https://community.esri.com/t5/python-questions/default-arcpy-getparameterastext-0/m-p/569915#M44677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;are you looking to set parameters? this is one, there are other options in the same help file vacinity&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/setparameterastext.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/setparameterastext.htm"&gt;SetParameterAsText—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2016 01:23:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/default-arcpy-getparameterastext-0/m-p/569915#M44677</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-11-16T01:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Default arcpy.GetParameterAsText(0)</title>
      <link>https://community.esri.com/t5/python-questions/default-arcpy-getparameterastext-0/m-p/569916#M44678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got it with this: &amp;nbsp;&lt;A class="link-titled" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00150000000n000000" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//00150000000n000000"&gt;ArcGIS Help 10.1&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Was able to set the default when I was setting parameters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2016 01:24:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/default-arcpy-getparameterastext-0/m-p/569916#M44678</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-11-16T01:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Default arcpy.GetParameterAsText(0)</title>
      <link>https://community.esri.com/t5/python-questions/default-arcpy-getparameterastext-0/m-p/569917#M44679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you creating a tool in a toolbox for your user input?&amp;nbsp; If so, you you set up you default int he Parmaters box, for example:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="264307" alt="" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/264307_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in the script, you could have something like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Script arguments...&lt;/SPAN&gt;
targetGDB &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetParameterAsText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; targetGDB&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp; targetGDB &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'\\DFGANCGISDEV3\agsdev\data\update.gdb'&lt;/SPAN&gt; ‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simple sample, but then you repeat for the other parameters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: by the way, I should mention that they will see the default you have in the Parameter box, but can change it.&amp;nbsp;&amp;nbsp; The "if not" covers if nothing is input....at least you ahve the default, for example if you didn't have a default in the Parameter box, and they left the input blank, you could still have the default.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:32:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/default-arcpy-getparameterastext-0/m-p/569917#M44679</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2021-12-12T00:32:15Z</dc:date>
    </item>
  </channel>
</rss>

