<?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 GP Service default values in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/gp-service-default-values/m-p/447539#M17304</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: oearley&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Firstly, apologies for the length of this post but it clearly steps through the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been struggling with the new idea of publishing GP services only after having run them in ArcMap �?? others have already raised some of my concerns in this thread: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/61461-publishing-a-geoprocessing-toolbox" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/61461-publishing-a-geoprocessing-toolbox&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, running a script in ArcMap first raises an interesting behavior concerning default values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a test python script to demonstrate the issue:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;p0 = arcpy.GetParameterAsText(0)
p1 = arcpy.GetParameterAsText(1)
p2 = arcpy.GetParameterAsText(2)
# Test/replace input values
if p1 == "#" or not p1:
&amp;nbsp;&amp;nbsp;&amp;nbsp; p1 = 'NULL'
if p2 == "#" or not p2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; p2 = 'NULL'
output = '{0}-{1}-{2}'.format(p0,p1,p2)
arcpy.SetParameterAsText(3, output)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No default values are set in the script parameters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]34074[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Run in ArcMap&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then run the script in ArcMap with the following values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;p0 = A&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;p1 = B&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;p2 = &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The result is what I expected, output = 'A-B-NULL'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]34075[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Publish to Server&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I right-click on the result and publish to server �?? this takes over 10 minutes to complete (9+ minutes to stage and 48 seconds to publish). This is a 10 line script with 3 input parameters and 1 output, no processing at all beyond a couple of conditional statements and a single string concatenation. It takes less than a second to run the script in ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]34076[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bonus question: The machine this is running on is a fairly old work PC but what is ArcGIS doing that could possibly take this long?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Test a Submit Job&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I navigate to the GP service tool, for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;http://myserver/arcgis/rest/services/testScript/GPServer/Test%20Script/submitJob&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The web user interface displays the values used when running the script in ArcMap as the default values (not the values set in the Test Script Properties). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I clear the optional p1 parameter and run the tool I would expect to get the result: A-NULL-NULL&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when the tool is run the submit job user interface shows the parameter values as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input Parameter: p0 (Test Script)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "paramName": "p0",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "dataType": "GPString",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "value": "A"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input Parameter: p1 (Test Script)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "paramName": "p1",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "dataType": "GPString"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;Note the absence of a value for p1.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input Parameter: p2 (Test Script)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "paramName": "p2",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "dataType": "GPString"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Result Parameter: Output (Test Script)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "paramName": "Output",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "dataType": "GPString",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "value": "A-B-NULL"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why is the original value �??B�?? used when I explicitly cleared it? - a null value should have been passed into the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To me, a default value has a very different meaning to a null value. If this parameter is optional a null value is totally acceptable and should not be replaced with the default (displayed) value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will look at modifying my other scripts to use null values when running them in ArcMap before publishing but this looks like either a bug or a bad design decision.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Owen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 19:58:59 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-11T19:58:59Z</dc:date>
    <item>
      <title>GP Service default values</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/gp-service-default-values/m-p/447539#M17304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: oearley&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Firstly, apologies for the length of this post but it clearly steps through the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been struggling with the new idea of publishing GP services only after having run them in ArcMap �?? others have already raised some of my concerns in this thread: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/61461-publishing-a-geoprocessing-toolbox" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/61461-publishing-a-geoprocessing-toolbox&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, running a script in ArcMap first raises an interesting behavior concerning default values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a test python script to demonstrate the issue:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;p0 = arcpy.GetParameterAsText(0)
p1 = arcpy.GetParameterAsText(1)
p2 = arcpy.GetParameterAsText(2)
# Test/replace input values
if p1 == "#" or not p1:
&amp;nbsp;&amp;nbsp;&amp;nbsp; p1 = 'NULL'
if p2 == "#" or not p2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; p2 = 'NULL'
output = '{0}-{1}-{2}'.format(p0,p1,p2)
arcpy.SetParameterAsText(3, output)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No default values are set in the script parameters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]34074[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Run in ArcMap&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then run the script in ArcMap with the following values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;p0 = A&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;p1 = B&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;p2 = &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The result is what I expected, output = 'A-B-NULL'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]34075[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Publish to Server&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I right-click on the result and publish to server �?? this takes over 10 minutes to complete (9+ minutes to stage and 48 seconds to publish). This is a 10 line script with 3 input parameters and 1 output, no processing at all beyond a couple of conditional statements and a single string concatenation. It takes less than a second to run the script in ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]34076[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bonus question: The machine this is running on is a fairly old work PC but what is ArcGIS doing that could possibly take this long?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Test a Submit Job&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I navigate to the GP service tool, for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;http://myserver/arcgis/rest/services/testScript/GPServer/Test%20Script/submitJob&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The web user interface displays the values used when running the script in ArcMap as the default values (not the values set in the Test Script Properties). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I clear the optional p1 parameter and run the tool I would expect to get the result: A-NULL-NULL&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when the tool is run the submit job user interface shows the parameter values as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input Parameter: p0 (Test Script)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "paramName": "p0",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "dataType": "GPString",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "value": "A"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input Parameter: p1 (Test Script)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "paramName": "p1",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "dataType": "GPString"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;Note the absence of a value for p1.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input Parameter: p2 (Test Script)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "paramName": "p2",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "dataType": "GPString"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Result Parameter: Output (Test Script)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "paramName": "Output",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "dataType": "GPString",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "value": "A-B-NULL"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why is the original value �??B�?? used when I explicitly cleared it? - a null value should have been passed into the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To me, a default value has a very different meaning to a null value. If this parameter is optional a null value is totally acceptable and should not be replaced with the default (displayed) value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will look at modifying my other scripts to use null values when running them in ArcMap before publishing but this looks like either a bug or a bad design decision.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Owen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:58:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/gp-service-default-values/m-p/447539#M17304</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T19:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: GP Service default values</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/gp-service-default-values/m-p/447540#M17305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am also having the same problem. I do not know how to clear default values while publishing GP.&lt;/P&gt;&lt;P&gt;As I know there is no option to remove default values in service editor dialogue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;K S Krishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 13:25:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/gp-service-default-values/m-p/447540#M17305</guid>
      <dc:creator>subba_krishnakatta1</dc:creator>
      <dc:date>2015-05-11T13:25:00Z</dc:date>
    </item>
  </channel>
</rss>

