<?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: Call &amp; pass parameters to GP Service in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/call-pass-parameters-to-gp-service/m-p/332085#M25826</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;any ideas what could be happening?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Apr 2020 20:15:53 GMT</pubDate>
    <dc:creator>jaykapalczynski</dc:creator>
    <dc:date>2020-04-01T20:15:53Z</dc:date>
    <item>
      <title>Call &amp; pass parameters to GP Service</title>
      <link>https://community.esri.com/t5/python-questions/call-pass-parameters-to-gp-service/m-p/332084#M25825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a python script that works great.&lt;/P&gt;&lt;P&gt;I created a tool in a toolbox and point to the python script and this runs great.&lt;/P&gt;&lt;P&gt;I then run the tool again and publish it to a service.&lt;/P&gt;&lt;P&gt;From the service I add my parameter (see below) and it runs great.&lt;/P&gt;&lt;P&gt;SO far so good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now from JavaScript I do the following (see below code at bottom).&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this time it does not accept the parameter it keeps using the &lt;SPAN style="text-decoration: underline;"&gt;default value&lt;/SPAN&gt; that was created on the service after I published it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To publish the service I am right clicking the result in ArcMap and using that to publish&lt;/P&gt;&lt;P&gt;1. I cannot figure out how to remove the default value&lt;/P&gt;&lt;P&gt;2. I cannot figure out&amp;nbsp; how to run the tool without adding a parameter before I publish it to ArcGIS Server&lt;/P&gt;&lt;P&gt;3. I cannot figure out how to over write the default value from JavaScript...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/486998_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I copy the string I am trying to use in Javascript and paste it in the GPService in ArcGIS Server it runs FINE.&lt;/P&gt;&lt;P&gt;BUT using the same string and calling the SAME ArcGIS Service from JavaScript it uses the default value that was created when it was published to ArcGIS Server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;&amp;nbsp;can copy the below string DIRECTLY from the code below without the ; at the end and it works fine in the GP Service&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{"employees": [{ "address": "1520 Split Oak Ln, Henrico, Virginia, 23229", "distance": "10", "id": "1" }, { "address": "113 Buffalo Rd, Clarksville, Virginia(VA), 23927", "distance": "50", "id": "4" }, { "address": "8817 Sherando Dr, Bristow, Virginia(VA), 20136", "distance": "20", "id": "5" }]}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it the default value?&lt;/P&gt;&lt;P&gt;Is it how I am pushing the parameter to the Service?&lt;/P&gt;&lt;P&gt;Something else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that makes sense.&amp;nbsp; Thoughts????&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; gpUrlJSON &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"https://vvvvvv.gov/arcgis/rest/services/Test/GeometryJSON/GPServer/createJSON"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; gpJSON &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;Geoprocessor&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gpUrlJSON&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;



&lt;SPAN class="comment token"&gt;// SNIP&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; dictstring &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"employees"&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; &lt;SPAN class="string token"&gt;"address"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"1520 Split Oak Ln, Henrico, Virginia, 23229"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"distance"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"10"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"id"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"1"&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; &lt;SPAN class="string token"&gt;"address"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"113 Buffalo Rd, Clarksville, Virginia(VA), 23927"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"distance"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"50"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"id"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"4"&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; &lt;SPAN class="string token"&gt;"address"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"8817 Sherando Dr, Bristow, Virginia(VA), 20136"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"distance"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"20"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"id"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"5"&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;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
            
dictstringtoPass &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; dictstring&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

gpJSON&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;dictstringtoPass&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&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;/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;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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:43:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/call-pass-parameters-to-gp-service/m-p/332084#M25825</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2021-12-11T15:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Call &amp; pass parameters to GP Service</title>
      <link>https://community.esri.com/t5/python-questions/call-pass-parameters-to-gp-service/m-p/332085#M25826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;any ideas what could be happening?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2020 20:15:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/call-pass-parameters-to-gp-service/m-p/332085#M25826</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2020-04-01T20:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Call &amp; pass parameters to GP Service</title>
      <link>https://community.esri.com/t5/python-questions/call-pass-parameters-to-gp-service/m-p/332086#M25827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I feel so embarrassed....I wasnt creating the params correctly...I was never calling the parameter by its name so it just used the default.&lt;/P&gt;&lt;P&gt;Where "request" was the name of the input parameter as seen in my original post&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;var dictstring = {"employees": [{ "address": "1520 Split Oak Ln, Henrico, Virginia, 23229", "distance": "10", "id": "1" }, { "address": "113 Buffalo Rd, Clarksville, Virginia(VA), 23927", "distance": "50", "id": "4" }, { "address": "8817 Sherando Dr, Bristow, Virginia(VA), 20136", "distance": "20", "id": "5" }]};
            
dictstringtoPass = dictstring;
gpJSON.execute(dictstringtoPass);&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;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; params &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    request&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; dictstring
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

gpJSON&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;params&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:43:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/call-pass-parameters-to-gp-service/m-p/332086#M25827</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2021-12-11T15:43:36Z</dc:date>
    </item>
  </channel>
</rss>

