I am running a spatial query that is finding a polygon and retuning a field value...I can get that to a message box fine...as well as displaying the graphic for the polygon that worksWhat am trying to do is then use that value to fuel another query to find the point location relevant to that polygons valueI find the precinct polygon and return its precinct number (11)In the next set of data (points) there is a field Precinct_Nu that also has a value of (11)I am trying to uset eh varaible in the query to run the second query...This is what I am trying but there is an issue with the query as if fails....any thoughts? Simply tryign to get a graphic to show up.....Thoughts? THanks Private Sub QueryTask_ExecuteCompletedSpatial_Precincts(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.Tasks.QueryEventArgs)
Dim featureSet As FeatureSet = args.FeatureSet
imageListBuffer_Precincts.ItemsSource = args.FeatureSet.Features
Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MySelectionGraphicsLayerPrecincts"), GraphicsLayer)
Dim PrecinctValue As String = Nothing
If featureSet IsNot Nothing AndAlso featureSet.Features.Count > 0 Then
For Each feature As Graphic In featureSet.Features
feature.Symbol = TryCast(LayoutRoot.Resources("PrecinctsFill"), FillSymbol)
graphicsLayer.Graphics.Insert(0, feature)
PrecinctValue = feature.Attributes("PRECINCTS_")
Next feature
End If
Dim PrecinctValue2 As String = PrecinctValue
MessageBox.Show(PrecinctValue2)
Dim queryTask As New QueryTask("http://gis.logis.org/arcgis/rest/services/MG_Test/MapServer/18")
AddHandler queryTask.ExecuteCompleted, AddressOf QueryTaskFindPrecinctPoints
AddHandler queryTask.Failed, AddressOf QueryTaskFindPID_FailedPrecinctPoints
Dim query As New ESRI.ArcGIS.Client.Tasks.Query()
query.OutFields.Add("*")
query.Where = String.Format("PrecinctNu '%{0}%'", PrecinctValue2.Trim())
query.ReturnGeometry = True
query.OutSpatialReference = MyMap.SpatialReference
queryTask.ExecuteAsync(query)
' snip
Private Sub QueryTaskFindPrecinctPoints(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.Tasks.QueryEventArgs)
Dim featureSet As FeatureSet = args.FeatureSet
' If an item has been selected
Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MySelectionGraphicsLayerPrecinctsPts"), GraphicsLayer)
graphicsLayer.ClearGraphics()
'If featureSet IsNot Nothing AndAlso featureSet.Features.Count > 0 Then
If featureSet IsNot Nothing AndAlso featureSet.Features.Count < 2 Then
' Show selected feature attributes in DataGrid
Dim selectedFeature As Graphic = featureSet.Features(0)
' Hightlight selected feature
selectedFeature.Symbol = TryCast(LayoutRoot.Resources("StrobeMarkerSymbol_Red"), ESRI.ArcGIS.Client.Symbols.Symbol)
graphicsLayer.Graphics.Add(selectedFeature)
MessageBox.Show("Got One")
ElseIf featureSet.Features.Count > 1 Then
MessageBox.Show("No results, Please enter teh entire PID value ex. 1211922220012")
Else
End If
End Sub