Please Help
I am trying to run a GP task from a test Appstudio app.
This is what I have right now and want to see if I am on the right path....as this varies from the JavaScript API
1. ALL I am trying to do is Pass a few variables on a button click to the GP service.
2. Once at the GPS Service I want to write those to Variables.
I just want to make sure I can transfer this data and grab it on the back end.
Right now I am referencing an ESRI same service I will replace this with mine.
<SPAN class="comment token">// snip</SPAN>
property GeoprocessingJob viewshedJob<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">null</SPAN>
<SPAN class="comment token">// snip</SPAN>
<SPAN class="comment token">// ON BUTTON CLICK I WILL LAUNCH THIS</SPAN>
<SPAN class="comment token">// viewshedTask.calculateViewshed(mouse.mapPoint);</SPAN>
GeoprocessingTask <SPAN class="punctuation token">{</SPAN>
id<SPAN class="punctuation token">:</SPAN> viewshedTask
url<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"https://sampleserver6.arcgisonline.com/arcgis/rest/services/Elevation/ESRI_Elevation_World/GPServer/Viewshed"</SPAN>
<SPAN class="keyword token">function</SPAN> <SPAN class="token function">calculateViewshed</SPAN><SPAN class="punctuation token">(</SPAN>location<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> viewshedParameters <SPAN class="operator token">=</SPAN> ArcGISRuntimeEnvironment<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createObject</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"GeoprocessingParameters"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">{</SPAN>
executionType<SPAN class="punctuation token">:</SPAN> Enums<SPAN class="punctuation token">.</SPAN>GeoprocessingExecutionTypeSynchronousExecute
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> ObjectID <SPAN class="operator token">=</SPAN> <SPAN class="string token">"65421"</SPAN> <SPAN class="comment token">// will get these values from textboxes </SPAN>
<SPAN class="keyword token">var</SPAN> Comments <SPAN class="operator token">=</SPAN> <SPAN class="string token">"something"</SPAN> <SPAN class="comment token">// will get these values from textboxes </SPAN>
<SPAN class="keyword token">var</SPAN> params <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN><SPAN class="string token">"OBHECTID"</SPAN><SPAN class="punctuation token">:</SPAN>ObjectID<SPAN class="punctuation token">,</SPAN><SPAN class="string token">"comments"</SPAN><SPAN class="punctuation token">:</SPAN>Comments <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
viewshedParameters <SPAN class="operator token">=</SPAN> params<SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Create the job that handles the communication between the application and the geoprocessing task</SPAN>
viewshedJob <SPAN class="operator token">=</SPAN> viewshedTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createJob</SPAN><SPAN class="punctuation token">(</SPAN>viewshedParameters<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Create signal handler for the job</SPAN>
viewshedJob<SPAN class="punctuation token">.</SPAN>jobStatusChanged<SPAN class="punctuation token">.</SPAN><SPAN class="token function">connect</SPAN><SPAN class="punctuation token">(</SPAN>viewshedJobHandler<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// start the job</SPAN>
viewshedJob<SPAN class="punctuation token">.</SPAN><SPAN class="token function">start</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN><SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">import</SPAN> os
# Geting user input <SPAN class="keyword token">for</SPAN> project name<SPAN class="punctuation token">,</SPAN> status<SPAN class="punctuation token">,</SPAN> type<SPAN class="punctuation token">,</SPAN> submital date and planner name
varObjectID <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetParameterAsText</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN>
varComments <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetParameterAsText</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN>
# <SPAN class="keyword token">do</SPAN> something <SPAN class="keyword token">with</SPAN> the returned values
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>