Select to view content in your preferred language

Query Question

765
7
11-22-2010 08:55 AM
EmilyLaMunyon
Deactivated User
Hello,

I am working with the Flex API samples in Flash 4 and am having some problems with a query in which the results are displayed in a table. Everything looks good in the browser, however, when I try to run the query nothing happens. Any insight?

Thanks!
Tags (2)
0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus
Emily,

This is your issue:

<esri:QueryTask            
  id="queryTask"
  url="http://gis.slco.org/wwwrest/services/public/Surveyor/MapServer/2"/>
0 Kudos
EmilyLaMunyon
Deactivated User
Thanks Robert! I get confused when to add the layer number to the url and when not to.

I made the suggested change and it still seems to not work. I am not sure what is going on, but when I execute the query, nothing happens still and I get a message in the bottom-left browser reading..Transferring data from gis.slco.org for like 15 minutes. Could this have something to do with our server or is it the code?

Thanks so much!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Emily,

  Maybe it's not getting the changes compiled. I have put your code into a new FlexBuilder 3 app and it functions for me with the small change I suggested.
0 Kudos
EmilyLaMunyon
Deactivated User
Does it matter that I am using Flash 4?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Emily,

   Yep it matters than you should be doing something like this then:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" 
      xmlns:mx="library://ns.adobe.com/flex/mx"
      xmlns:esri="http://www.esri.com/2008/ags" 
      xmlns:tasks="com.esri.ags.tasks.*" 
      xmlns:supportClasses="com.esri.ags.tasks.supportClasses.*">
 <s:layout>
  <s:BasicLayout/>
 </s:layout>
 <fx:Declarations>
  <tasks:QueryTask
   id="queryTask"
   url="http://gis.slco.org/wwwrest/services/public/Surveyor/MapServer/2"
      concurrency="last"
    useAMF="false"/>
  <supportClasses:Query
   id="query"            
   returnGeometry="false"            
   text="{cityName.text}"            
   outFields="*"/>
 </fx:Declarations>
  
 <esri:Map id="map">
  <esri:ArcGISDynamicMapServiceLayer url="http://gis.slco.org/wwwrest/services/public/Surveyor/MapServer" />
 </esri:Map>
 
 <s:Panel title="Using Query tasks without maps"> 
  <s:VGroup>
   <s:HGroup verticalAlign="middle">
    <s:Label text="City Name: " /> 
    <s:TextInput id="cityName" text="Holladay" />
    <s:Button label="Get Details" click="queryTask.execute(query);" />
   </s:HGroup>
   <mx:DataGrid id="resultsGrid" dataProvider="{queryTask.executeLastResult.attributes}" visible="{queryTask.executeLastResult != null}" >            
    <mx:columns>                
     <mx:DataGridColumn headerText="City Name" dataField="CITY"/>                
    </mx:columns>        
   </mx:DataGrid>
  </s:VGroup>       
 </s:Panel>
</s:Application>
0 Kudos
EmilyLaMunyon
Deactivated User
Thanks once again, it worked!

I was using the old samples I guess...where can I find code samples for the Flex API for Flash 4?

Thanks!
0 Kudos
DasaPaddock
Esri Regular Contributor
0 Kudos