Select to view content in your preferred language

Not able to query when useamf = true

2208
18
01-17-2011 11:19 PM
sheebaashraf
Deactivated User
I'm not able to do query when useamf = true. however I'm able to query when useamf is false
Tags (2)
0 Kudos
18 Replies
RobertScheitlin__GISP
MVP Emeritus
mohd,

useamf = true requires ArcGIS Server 10 as the documentation states.

http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/tasks/QueryTask.html

Use AMF for execute() and executeRelationshipQuery(). Requires the server to be   ArcGIS Server 10.0 or above, set to false if using earlier server versions. When useAMF is true, the BaseTask properties concurrency, requestTimeout and showBusyCursor are ignored.
0 Kudos
sheebaashraf
Deactivated User
Thanks Robert,

I'm using Arcgis 10

I'm able to query the  AMF format using service directory. but not through my application
In fact I know amf is supported in Arcgis 10
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
mohd,

   Then you need to post your code that you are using. Most people that have issue with useAMF don't know that they need ArcGIS Server 10. That is the reason for my previous post.
0 Kudos
sheebaashraf
Deactivated User
Thanks for your reply

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:s="library://ns.adobe.com/flex/spark"
pageTitle="Query Task (with a map)">


<s:layout>
<s:VerticalLayout gap="10"
horizontalAlign="center"
paddingBottom="20"
paddingLeft="25"
paddingRight="25"
paddingTop="20"/>
</s:layout>

<fx:Script>
<![CDATA[
import com.esri.ags.Graphic;
import com.esri.ags.FeatureSet;
import mx.controls.Alert;
import mx.rpc.AsyncResponder;

private function doQuery():void
{
queryTask.execute(query, new AsyncResponder(onResult, onFault));
function onResult(featureSet:FeatureSet, token:Object = null):void
{
Alert.show("done");
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString(), "Query Problem");
}
}
]]>
</fx:Script>

<fx:Declarations>
<!-- Layer with US States -->
<esri:QueryTask id="queryTask"
showBusyCursor="true"
url="http://testserver/ArcGIS/rest/services/testservices/MapServer/5"
useAMF="true"/>

<esri:Query id="query"
outSpatialReference="{myMap.spatialReference}"
returnGeometry="true"
text="{qText.text}">
<esri:outFields>
<fx:String>Name</fx:String>
<fx:String>Value</fx:String>
</esri:outFields>
</esri:Query>
</fx:Declarations>

<s:Panel height="60"
backgroundColor="0xB2BFC6"
title="Query a layer (search for a state)">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:TextInput id="qText"
width="100%"
enter="doQuery()"
text="California"/>
<s:Button click="doQuery()" label="Do Query"/>
</s:Panel>

<esri:Map id="myMap">
<esri:extent>
<esri:Extent xmin="-14298000" ymin="2748000" xmax="-6815000" ymax="7117000">
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer url="http://testserver/ArcGIS/rest/services/testservices2/MapServer"/>
</esri:Map>

</s:Application>

Note: If i set useAMF="false" it works
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mohd,

   Which version of the Flex API are you using?
0 Kudos
sheebaashraf
Deactivated User
Robert,

Arcgis flex apis 2.0.

Just want to share with you I have map services hosted on another server and when I use that service hosted there it works fine for me.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mohd,

    That is what I find also. If I use one of my map services that is on a 10 server and switch the outfields to mine than your code works fine. This leads me to believe you have a server issue and that is best handled by ESRI tech support.
0 Kudos
sheebaashraf
Deactivated User
Dear Robert

Do you installed Arcgis server SP1. Can I have your email Id.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mohd,

   Yes I do have SP1 installed. I don't give out my email. But if you post questions to the forum I am always monitoring the Flex API and FlexViewer forums.
0 Kudos