AnsweredAssumed Answered

How to manage multiple results from Asynch geoprocessing tool?

Question asked by shamr0ck01 on Aug 23, 2012
Latest reply on Aug 28, 2012 by geos_rfleet
I have a geoprocessing tool that is returning both a GPDataFile and a GPFeatureRecordSetLayer. How would I access both of these results?

I know how to do it in C#/Silverlight but I am new to Javascript and don't have a handle on all of the nomenclature for it yet.

Here is the C#/Silverlight Code
private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)         {             if (e.JobInfo.JobStatus != esriJobStatus.esriJobSucceeded)             {                 MessageBox.Show("Geoprocessor service failed" );                 ProcessingTextBlock.Text = "";                  ProcessingTextBlock.Visibility = Visibility.Collapsed;                                  GraphicsLayer graphicsLayer = Map.Layers["Results"] as GraphicsLayer;                 GraphicsLayer startLayer = Map.Layers["MyGraphicsLayer"] as GraphicsLayer;                 graphicsLayer.ClearGraphics();                 startLayer.ClearGraphics();                 this.SpreadModel.IsOpen = !this.SpreadModel.IsOpen;              }             else              {                 Geoprocessor geoprocessorTask = sender as Geoprocessor;                 geoprocessorTask.GetResultDataCompleted += (s1, ev1) =>                     {                                                                       if (ev1.Parameter is GPFeatureRecordSetLayer)                         {                             GraphicsLayer graphicsLayer = Map.Layers["Results"] as GraphicsLayer;                              GPFeatureRecordSetLayer gpLayer = ev1.Parameter as GPFeatureRecordSetLayer;                                  foreach (Graphic graphic in gpLayer.FeatureSet.Features)                             {                                                                                                     graphic.Symbol = LayoutRoot.Resources["MyGreenFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;                                                                   graphicsLayer.Graphics.Add(graphic);                                                   }                          }                         if (ev1.Parameter is GPDataFile)                         {                             GPDataFile gpdata = ev1.Parameter as GPDataFile;                             Uri uri = new Uri(gpdata.Url);                             btndownload.NavigateUri = uri;                              urltodownload = uri;                                                           geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "RelativeSpread");                                                      }                      };                  geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Outfile");                               }         }


Basically would like to take my C# code and convert it to Javascript /Dojo.

Outcomes